scu_task_context.h 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943
  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. #ifndef _SCU_TASK_CONTEXT_H_
  56. #define _SCU_TASK_CONTEXT_H_
  57. /**
  58. * This file contains the structures and constants for the SCU hardware task
  59. * context.
  60. *
  61. *
  62. */
  63. /**
  64. * enum scu_ssp_task_type - This enumberation defines the various SSP task
  65. * types the SCU hardware will accept. The definition for the various task
  66. * types the SCU hardware will accept can be found in the DS specification.
  67. *
  68. *
  69. */
  70. typedef enum {
  71. SCU_TASK_TYPE_IOREAD, /* /< IO READ direction or no direction */
  72. SCU_TASK_TYPE_IOWRITE, /* /< IO Write direction */
  73. SCU_TASK_TYPE_SMP_REQUEST, /* /< SMP Request type */
  74. SCU_TASK_TYPE_RESPONSE, /* /< Driver generated response frame (targt mode) */
  75. SCU_TASK_TYPE_RAW_FRAME, /* /< Raw frame request type */
  76. SCU_TASK_TYPE_PRIMITIVE /* /< Request for a primitive to be transmitted */
  77. } scu_ssp_task_type;
  78. /**
  79. * enum scu_sata_task_type - This enumeration defines the various SATA task
  80. * types the SCU hardware will accept. The definition for the various task
  81. * types the SCU hardware will accept can be found in the DS specification.
  82. *
  83. *
  84. */
  85. typedef enum {
  86. SCU_TASK_TYPE_DMA_IN, /* /< Read request */
  87. SCU_TASK_TYPE_FPDMAQ_READ, /* /< NCQ read request */
  88. SCU_TASK_TYPE_PACKET_DMA_IN, /* /< Packet read request */
  89. SCU_TASK_TYPE_SATA_RAW_FRAME, /* /< Raw frame request */
  90. RESERVED_4,
  91. RESERVED_5,
  92. RESERVED_6,
  93. RESERVED_7,
  94. SCU_TASK_TYPE_DMA_OUT, /* /< Write request */
  95. SCU_TASK_TYPE_FPDMAQ_WRITE, /* /< NCQ write Request */
  96. SCU_TASK_TYPE_PACKET_DMA_OUT /* /< Packet write request */
  97. } scu_sata_task_type;
  98. /**
  99. *
  100. *
  101. * SCU_CONTEXT_TYPE
  102. */
  103. #define SCU_TASK_CONTEXT_TYPE 0
  104. #define SCU_RNC_CONTEXT_TYPE 1
  105. /**
  106. *
  107. *
  108. * SCU_TASK_CONTEXT_VALIDITY
  109. */
  110. #define SCU_TASK_CONTEXT_INVALID 0
  111. #define SCU_TASK_CONTEXT_VALID 1
  112. /**
  113. *
  114. *
  115. * SCU_COMMAND_CODE
  116. */
  117. #define SCU_COMMAND_CODE_INITIATOR_NEW_TASK 0
  118. #define SCU_COMMAND_CODE_ACTIVE_TASK 1
  119. #define SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK 2
  120. #define SCU_COMMAND_CODE_TARGET_RAW_FRAMES 3
  121. /**
  122. *
  123. *
  124. * SCU_TASK_PRIORITY
  125. */
  126. /**
  127. *
  128. *
  129. * This priority is used when there is no priority request for this request.
  130. */
  131. #define SCU_TASK_PRIORITY_NORMAL 0
  132. /**
  133. *
  134. *
  135. * This priority indicates that the task should be scheduled to the head of the
  136. * queue. The task will NOT be executed if the TX is suspended for the remote
  137. * node.
  138. */
  139. #define SCU_TASK_PRIORITY_HEAD_OF_Q 1
  140. /**
  141. *
  142. *
  143. * This priority indicates that the task will be executed before all
  144. * SCU_TASK_PRIORITY_NORMAL and SCU_TASK_PRIORITY_HEAD_OF_Q tasks. The task
  145. * WILL be executed if the TX is suspended for the remote node.
  146. */
  147. #define SCU_TASK_PRIORITY_HIGH 2
  148. /**
  149. *
  150. *
  151. * This task priority is reserved and should not be used.
  152. */
  153. #define SCU_TASK_PRIORITY_RESERVED 3
  154. #define SCU_TASK_INITIATOR_MODE 1
  155. #define SCU_TASK_TARGET_MODE 0
  156. #define SCU_TASK_REGULAR 0
  157. #define SCU_TASK_ABORTED 1
  158. /* direction bit defintion */
  159. /**
  160. *
  161. *
  162. * SATA_DIRECTION
  163. */
  164. #define SCU_SATA_WRITE_DATA_DIRECTION 0
  165. #define SCU_SATA_READ_DATA_DIRECTION 1
  166. /**
  167. *
  168. *
  169. * SCU_COMMAND_CONTEXT_MACROS These macros provide the mask and shift
  170. * operations to construct the various SCU commands
  171. */
  172. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT 21
  173. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK 0x00E00000
  174. #define scu_get_command_request_type(x) \
  175. ((x) & SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK)
  176. #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT 18
  177. #define SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK 0x001C0000
  178. #define scu_get_command_request_subtype(x) \
  179. ((x) & SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK)
  180. #define SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK \
  181. (\
  182. SCU_CONTEXT_COMMAND_REQUEST_TYPE_MASK \
  183. | SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_MASK \
  184. )
  185. #define scu_get_command_request_full_type(x) \
  186. ((x) & SCU_CONTEXT_COMMAND_REQUEST_FULLTYPE_MASK)
  187. #define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_SHIFT 16
  188. #define SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK 0x00010000
  189. #define scu_get_command_protocl_engine_group(x) \
  190. ((x) & SCU_CONTEXT_COMMAND_PROTOCOL_ENGINE_GROUP_MASK)
  191. #define SCU_CONTEXT_COMMAND_LOGICAL_PORT_SHIFT 12
  192. #define SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK 0x00007000
  193. #define scu_get_command_reqeust_logical_port(x) \
  194. ((x) & SCU_CONTEXT_COMMAND_LOGICAL_PORT_MASK)
  195. #define MAKE_SCU_CONTEXT_COMMAND_TYPE(type) \
  196. ((u32)(type) << SCU_CONTEXT_COMMAND_REQUEST_TYPE_SHIFT)
  197. /**
  198. * MAKE_SCU_CONTEXT_COMMAND_TYPE() -
  199. *
  200. * SCU_COMMAND_TYPES These constants provide the grouping of the different SCU
  201. * command types.
  202. */
  203. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC MAKE_SCU_CONTEXT_COMMAND_TYPE(0)
  204. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC MAKE_SCU_CONTEXT_COMMAND_TYPE(1)
  205. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC MAKE_SCU_CONTEXT_COMMAND_TYPE(2)
  206. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC MAKE_SCU_CONTEXT_COMMAND_TYPE(3)
  207. #define SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC MAKE_SCU_CONTEXT_COMMAND_TYPE(6)
  208. #define MAKE_SCU_CONTEXT_COMMAND_REQUEST(type, command) \
  209. ((type) | ((command) << SCU_CONTEXT_COMMAND_REQUEST_SUBTYPE_SHIFT))
  210. /**
  211. *
  212. *
  213. * SCU_REQUEST_TYPES These constants are the various request types that can be
  214. * posted to the SCU hardware.
  215. */
  216. #define SCU_CONTEXT_COMMAND_REQUST_POST_TC \
  217. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 0))
  218. #define SCU_CONTEXT_COMMAND_REQUEST_POST_TC_ABORT \
  219. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_TC, 1))
  220. #define SCU_CONTEXT_COMMAND_REQUST_DUMP_TC \
  221. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_TC, 0))
  222. #define SCU_CONTEXT_COMMAND_POST_RNC_32 \
  223. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 0))
  224. #define SCU_CONTEXT_COMMAND_POST_RNC_96 \
  225. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 1))
  226. #define SCU_CONTEXT_COMMAND_POST_RNC_INVALIDATE \
  227. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_POST_RNC, 2))
  228. #define SCU_CONTEXT_COMMAND_DUMP_RNC_32 \
  229. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 0))
  230. #define SCU_CONTEXT_COMMAND_DUMP_RNC_96 \
  231. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_DUMP_RNC, 1))
  232. #define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX \
  233. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 0))
  234. #define SCU_CONTEXT_COMMAND_POST_RNC_SUSPEND_TX_RX \
  235. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 1))
  236. #define SCU_CONTEXT_COMMAND_POST_RNC_RESUME \
  237. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 2))
  238. #define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_ENABLE \
  239. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 3))
  240. #define SCU_CONTEXT_IT_NEXUS_LOSS_TIMER_DISABLE \
  241. (MAKE_SCU_CONTEXT_COMMAND_REQUEST(SCU_CONTEXT_COMMAND_REQUEST_TYPE_OTHER_RNC, 4))
  242. /**
  243. *
  244. *
  245. * SCU_TASK_CONTEXT_PROTOCOL SCU Task context protocol types this is uesd to
  246. * program the SCU Task context protocol field in word 0x00.
  247. */
  248. #define SCU_TASK_CONTEXT_PROTOCOL_SMP 0x00
  249. #define SCU_TASK_CONTEXT_PROTOCOL_SSP 0x01
  250. #define SCU_TASK_CONTEXT_PROTOCOL_STP 0x02
  251. #define SCU_TASK_CONTEXT_PROTOCOL_NONE 0x07
  252. /**
  253. * struct ssp_task_context - This is the SCU hardware definition for an SSP
  254. * request.
  255. *
  256. *
  257. */
  258. struct ssp_task_context {
  259. /* OFFSET 0x18 */
  260. u32 reserved00:24;
  261. u32 frame_type:8;
  262. /* OFFSET 0x1C */
  263. u32 reserved01;
  264. /* OFFSET 0x20 */
  265. u32 fill_bytes:2;
  266. u32 reserved02:6;
  267. u32 changing_data_pointer:1;
  268. u32 retransmit:1;
  269. u32 retry_data_frame:1;
  270. u32 tlr_control:2;
  271. u32 reserved03:19;
  272. /* OFFSET 0x24 */
  273. u32 uiRsvd4;
  274. /* OFFSET 0x28 */
  275. u32 target_port_transfer_tag:16;
  276. u32 tag:16;
  277. /* OFFSET 0x2C */
  278. u32 data_offset;
  279. };
  280. /**
  281. * struct stp_task_context - This is the SCU hardware definition for an STP
  282. * request.
  283. *
  284. *
  285. */
  286. struct stp_task_context {
  287. /* OFFSET 0x18 */
  288. u32 fis_type:8;
  289. u32 pm_port:4;
  290. u32 reserved0:3;
  291. u32 control:1;
  292. u32 command:8;
  293. u32 features:8;
  294. /* OFFSET 0x1C */
  295. u32 reserved1;
  296. /* OFFSET 0x20 */
  297. u32 reserved2;
  298. /* OFFSET 0x24 */
  299. u32 reserved3;
  300. /* OFFSET 0x28 */
  301. u32 ncq_tag:5;
  302. u32 reserved4:27;
  303. /* OFFSET 0x2C */
  304. u32 data_offset; /* TODO: What is this used for? */
  305. };
  306. /**
  307. * struct smp_task_context - This is the SCU hardware definition for an SMP
  308. * request.
  309. *
  310. *
  311. */
  312. struct smp_task_context {
  313. /* OFFSET 0x18 */
  314. u32 response_length:8;
  315. u32 function_result:8;
  316. u32 function:8;
  317. u32 frame_type:8;
  318. /* OFFSET 0x1C */
  319. u32 smp_response_ufi:12;
  320. u32 reserved1:20;
  321. /* OFFSET 0x20 */
  322. u32 reserved2;
  323. /* OFFSET 0x24 */
  324. u32 reserved3;
  325. /* OFFSET 0x28 */
  326. u32 reserved4;
  327. /* OFFSET 0x2C */
  328. u32 reserved5;
  329. };
  330. /**
  331. * struct primitive_task_context - This is the SCU hardware definition used
  332. * when the driver wants to send a primitive on the link.
  333. *
  334. *
  335. */
  336. struct primitive_task_context {
  337. /* OFFSET 0x18 */
  338. /**
  339. * This field is the control word and it must be 0.
  340. */
  341. u32 control; /* /< must be set to 0 */
  342. /* OFFSET 0x1C */
  343. /**
  344. * This field specifies the primitive that is to be transmitted.
  345. */
  346. u32 sequence;
  347. /* OFFSET 0x20 */
  348. u32 reserved0;
  349. /* OFFSET 0x24 */
  350. u32 reserved1;
  351. /* OFFSET 0x28 */
  352. u32 reserved2;
  353. /* OFFSET 0x2C */
  354. u32 reserved3;
  355. };
  356. /**
  357. * The union of the protocols that can be selected in the SCU task context
  358. * field.
  359. *
  360. * protocol_context
  361. */
  362. union protocol_context {
  363. struct ssp_task_context ssp;
  364. struct stp_task_context stp;
  365. struct smp_task_context smp;
  366. struct primitive_task_context primitive;
  367. u32 words[6];
  368. };
  369. /**
  370. * struct scu_sgl_element - This structure represents a single SCU defined SGL
  371. * element. SCU SGLs contain a 64 bit address with the maximum data transfer
  372. * being 24 bits in size. The SGL can not cross a 4GB boundary.
  373. *
  374. * struct scu_sgl_element
  375. */
  376. struct scu_sgl_element {
  377. /**
  378. * This field is the upper 32 bits of the 64 bit physical address.
  379. */
  380. u32 address_upper;
  381. /**
  382. * This field is the lower 32 bits of the 64 bit physical address.
  383. */
  384. u32 address_lower;
  385. /**
  386. * This field is the number of bytes to transfer.
  387. */
  388. u32 length:24;
  389. /**
  390. * This field is the address modifier to be used when a virtual function is
  391. * requesting a data transfer.
  392. */
  393. u32 address_modifier:8;
  394. };
  395. #define SCU_SGL_ELEMENT_PAIR_A 0
  396. #define SCU_SGL_ELEMENT_PAIR_B 1
  397. /**
  398. * struct scu_sgl_element_pair - This structure is the SCU hardware definition
  399. * of a pair of SGL elements. The SCU hardware always works on SGL pairs.
  400. * They are refered to in the DS specification as SGL A and SGL B. Each SGL
  401. * pair is followed by the address of the next pair.
  402. *
  403. *
  404. */
  405. struct scu_sgl_element_pair {
  406. /* OFFSET 0x60-0x68 */
  407. /**
  408. * This field is the SGL element A of the SGL pair.
  409. */
  410. struct scu_sgl_element A;
  411. /* OFFSET 0x6C-0x74 */
  412. /**
  413. * This field is the SGL element B of the SGL pair.
  414. */
  415. struct scu_sgl_element B;
  416. /* OFFSET 0x78-0x7C */
  417. /**
  418. * This field is the upper 32 bits of the 64 bit address to the next SGL
  419. * element pair.
  420. */
  421. u32 next_pair_upper;
  422. /**
  423. * This field is the lower 32 bits of the 64 bit address to the next SGL
  424. * element pair.
  425. */
  426. u32 next_pair_lower;
  427. };
  428. /**
  429. * struct transport_snapshot - This structure is the SCU hardware scratch area
  430. * for the task context. This is set to 0 by the driver but can be read by
  431. * issuing a dump TC request to the SCU.
  432. *
  433. *
  434. */
  435. struct transport_snapshot {
  436. /* OFFSET 0x48 */
  437. u32 xfer_rdy_write_data_length;
  438. /* OFFSET 0x4C */
  439. u32 data_offset;
  440. /* OFFSET 0x50 */
  441. u32 data_transfer_size:24;
  442. u32 reserved_50_0:8;
  443. /* OFFSET 0x54 */
  444. u32 next_initiator_write_data_offset;
  445. /* OFFSET 0x58 */
  446. u32 next_initiator_write_data_xfer_size:24;
  447. u32 reserved_58_0:8;
  448. };
  449. /**
  450. * struct scu_task_context - This structure defines the contents of the SCU
  451. * silicon task context. It lays out all of the fields according to the
  452. * expected order and location for the Storage Controller unit.
  453. *
  454. *
  455. */
  456. struct scu_task_context {
  457. /* OFFSET 0x00 ------ */
  458. /**
  459. * This field must be encoded to one of the valid SCU task priority values
  460. * - SCU_TASK_PRIORITY_NORMAL
  461. * - SCU_TASK_PRIORITY_HEAD_OF_Q
  462. * - SCU_TASK_PRIORITY_HIGH
  463. */
  464. u32 priority:2;
  465. /**
  466. * This field must be set to true if this is an initiator generated request.
  467. * Until target mode is supported all task requests are initiator requests.
  468. */
  469. u32 initiator_request:1;
  470. /**
  471. * This field must be set to one of the valid connection rates valid values
  472. * are 0x8, 0x9, and 0xA.
  473. */
  474. u32 connection_rate:4;
  475. /**
  476. * This field muse be programed when generating an SMP response since the SMP
  477. * connection remains open until the SMP response is generated.
  478. */
  479. u32 protocol_engine_index:3;
  480. /**
  481. * This field must contain the logical port for the task request.
  482. */
  483. u32 logical_port_index:3;
  484. /**
  485. * This field must be set to one of the SCU_TASK_CONTEXT_PROTOCOL values
  486. * - SCU_TASK_CONTEXT_PROTOCOL_SMP
  487. * - SCU_TASK_CONTEXT_PROTOCOL_SSP
  488. * - SCU_TASK_CONTEXT_PROTOCOL_STP
  489. * - SCU_TASK_CONTEXT_PROTOCOL_NONE
  490. */
  491. u32 protocol_type:3;
  492. /**
  493. * This filed must be set to the TCi allocated for this task
  494. */
  495. u32 task_index:12;
  496. /**
  497. * This field is reserved and must be set to 0x00
  498. */
  499. u32 reserved_00_0:1;
  500. /**
  501. * For a normal task request this must be set to 0. If this is an abort of
  502. * this task request it must be set to 1.
  503. */
  504. u32 abort:1;
  505. /**
  506. * This field must be set to true for the SCU hardware to process the task.
  507. */
  508. u32 valid:1;
  509. /**
  510. * This field must be set to SCU_TASK_CONTEXT_TYPE
  511. */
  512. u32 context_type:1;
  513. /* OFFSET 0x04 */
  514. /**
  515. * This field contains the RNi that is the target of this request.
  516. */
  517. u32 remote_node_index:12;
  518. /**
  519. * This field is programmed if this is a mirrored request, which we are not
  520. * using, in which case it is the RNi for the mirrored target.
  521. */
  522. u32 mirrored_node_index:12;
  523. /**
  524. * This field is programmed with the direction of the SATA reqeust
  525. * - SCU_SATA_WRITE_DATA_DIRECTION
  526. * - SCU_SATA_READ_DATA_DIRECTION
  527. */
  528. u32 sata_direction:1;
  529. /**
  530. * This field is programmsed with one of the following SCU_COMMAND_CODE
  531. * - SCU_COMMAND_CODE_INITIATOR_NEW_TASK
  532. * - SCU_COMMAND_CODE_ACTIVE_TASK
  533. * - SCU_COMMAND_CODE_PRIMITIVE_SEQ_TASK
  534. * - SCU_COMMAND_CODE_TARGET_RAW_FRAMES
  535. */
  536. u32 command_code:2;
  537. /**
  538. * This field is set to true if the remote node should be suspended.
  539. * This bit is only valid for SSP & SMP target devices.
  540. */
  541. u32 suspend_node:1;
  542. /**
  543. * This field is programmed with one of the following command type codes
  544. *
  545. * For SAS requests use the scu_ssp_task_type
  546. * - SCU_TASK_TYPE_IOREAD
  547. * - SCU_TASK_TYPE_IOWRITE
  548. * - SCU_TASK_TYPE_SMP_REQUEST
  549. * - SCU_TASK_TYPE_RESPONSE
  550. * - SCU_TASK_TYPE_RAW_FRAME
  551. * - SCU_TASK_TYPE_PRIMITIVE
  552. *
  553. * For SATA requests use the scu_sata_task_type
  554. * - SCU_TASK_TYPE_DMA_IN
  555. * - SCU_TASK_TYPE_FPDMAQ_READ
  556. * - SCU_TASK_TYPE_PACKET_DMA_IN
  557. * - SCU_TASK_TYPE_SATA_RAW_FRAME
  558. * - SCU_TASK_TYPE_DMA_OUT
  559. * - SCU_TASK_TYPE_FPDMAQ_WRITE
  560. * - SCU_TASK_TYPE_PACKET_DMA_OUT
  561. */
  562. u32 task_type:4;
  563. /* OFFSET 0x08 */
  564. /**
  565. * This field is reserved and the must be set to 0x00
  566. */
  567. u32 link_layer_control:8; /* presently all reserved */
  568. /**
  569. * This field is set to true when TLR is to be enabled
  570. */
  571. u32 ssp_tlr_enable:1;
  572. /**
  573. * This is field specifies if the SCU DMAs a response frame to host
  574. * memory for good response frames when operating in target mode.
  575. */
  576. u32 dma_ssp_target_good_response:1;
  577. /**
  578. * This field indicates if the SCU should DMA the response frame to
  579. * host memory.
  580. */
  581. u32 do_not_dma_ssp_good_response:1;
  582. /**
  583. * This field is set to true when strict ordering is to be enabled
  584. */
  585. u32 strict_ordering:1;
  586. /**
  587. * This field indicates the type of endianess to be utilized for the
  588. * frame. command, task, and response frames utilized control_frame
  589. * set to 1.
  590. */
  591. u32 control_frame:1;
  592. /**
  593. * This field is reserved and the driver should set to 0x00
  594. */
  595. u32 tl_control_reserved:3;
  596. /**
  597. * This field is set to true when the SCU hardware task timeout control is to
  598. * be enabled
  599. */
  600. u32 timeout_enable:1;
  601. /**
  602. * This field is reserved and the driver should set it to 0x00
  603. */
  604. u32 pts_control_reserved:7;
  605. /**
  606. * This field should be set to true when block guard is to be enabled
  607. */
  608. u32 block_guard_enable:1;
  609. /**
  610. * This field is reserved and the driver should set to 0x00
  611. */
  612. u32 sdma_control_reserved:7;
  613. /* OFFSET 0x0C */
  614. /**
  615. * This field is the address modifier for this io request it should be
  616. * programmed with the virtual function that is making the request.
  617. */
  618. u32 address_modifier:16;
  619. /**
  620. * @todo What we support mirrored SMP response frame?
  621. */
  622. u32 mirrored_protocol_engine:3; /* mirrored protocol Engine Index */
  623. /**
  624. * If this is a mirrored request the logical port index for the mirrored RNi
  625. * must be programmed.
  626. */
  627. u32 mirrored_logical_port:4; /* mirrored local port index */
  628. /**
  629. * This field is reserved and the driver must set it to 0x00
  630. */
  631. u32 reserved_0C_0:8;
  632. /**
  633. * This field must be set to true if the mirrored request processing is to be
  634. * enabled.
  635. */
  636. u32 mirror_request_enable:1; /* Mirrored request Enable */
  637. /* OFFSET 0x10 */
  638. /**
  639. * This field is the command iu length in dwords
  640. */
  641. u32 ssp_command_iu_length:8;
  642. /**
  643. * This is the target TLR enable bit it must be set to 0 when creatning the
  644. * task context.
  645. */
  646. u32 xfer_ready_tlr_enable:1;
  647. /**
  648. * This field is reserved and the driver must set it to 0x00
  649. */
  650. u32 reserved_10_0:7;
  651. /**
  652. * This is the maximum burst size that the SCU hardware will send in one
  653. * connection its value is (N x 512) and N must be a multiple of 2. If the
  654. * value is 0x00 then maximum burst size is disabled.
  655. */
  656. u32 ssp_max_burst_size:16;
  657. /* OFFSET 0x14 */
  658. /**
  659. * This filed is set to the number of bytes to be transfered in the request.
  660. */
  661. u32 transfer_length_bytes:24; /* In terms of bytes */
  662. /**
  663. * This field is reserved and the driver should set it to 0x00
  664. */
  665. u32 reserved_14_0:8;
  666. /* OFFSET 0x18-0x2C */
  667. /**
  668. * This union provides for the protocol specif part of the SCU Task Context.
  669. */
  670. union protocol_context type;
  671. /* OFFSET 0x30-0x34 */
  672. /**
  673. * This field is the upper 32 bits of the 64 bit physical address of the
  674. * command iu buffer
  675. */
  676. u32 command_iu_upper;
  677. /**
  678. * This field is the lower 32 bits of the 64 bit physical address of the
  679. * command iu buffer
  680. */
  681. u32 command_iu_lower;
  682. /* OFFSET 0x38-0x3C */
  683. /**
  684. * This field is the upper 32 bits of the 64 bit physical address of the
  685. * response iu buffer
  686. */
  687. u32 response_iu_upper;
  688. /**
  689. * This field is the lower 32 bits of the 64 bit physical address of the
  690. * response iu buffer
  691. */
  692. u32 response_iu_lower;
  693. /* OFFSET 0x40 */
  694. /**
  695. * This field is set to the task phase of the SCU hardware. The driver must
  696. * set this to 0x01
  697. */
  698. u32 task_phase:8;
  699. /**
  700. * This field is set to the transport layer task status. The driver must set
  701. * this to 0x00
  702. */
  703. u32 task_status:8;
  704. /**
  705. * This field is used during initiator write TLR
  706. */
  707. u32 previous_extended_tag:4;
  708. /**
  709. * This field is set the maximum number of retries for a STP non-data FIS
  710. */
  711. u32 stp_retry_count:2;
  712. /**
  713. * This field is reserved and the driver must set it to 0x00
  714. */
  715. u32 reserved_40_1:2;
  716. /**
  717. * This field is used by the SCU TL to determine when to take a snapshot when
  718. * tranmitting read data frames.
  719. * - 0x00 The entire IO
  720. * - 0x01 32k
  721. * - 0x02 64k
  722. * - 0x04 128k
  723. * - 0x08 256k
  724. */
  725. u32 ssp_tlr_threshold:4;
  726. /**
  727. * This field is reserved and the driver must set it to 0x00
  728. */
  729. u32 reserved_40_2:4;
  730. /* OFFSET 0x44 */
  731. u32 write_data_length; /* read only set to 0 */
  732. /* OFFSET 0x48-0x58 */
  733. struct transport_snapshot snapshot; /* read only set to 0 */
  734. /* OFFSET 0x5C */
  735. u32 block_protection_enable:1;
  736. u32 block_size:2;
  737. u32 block_protection_function:2;
  738. u32 reserved_5C_0:9;
  739. u32 active_sgl_element:2; /* read only set to 0 */
  740. u32 sgl_exhausted:1; /* read only set to 0 */
  741. u32 payload_data_transfer_error:4; /* read only set to 0 */
  742. u32 frame_buffer_offset:11; /* read only set to 0 */
  743. /* OFFSET 0x60-0x7C */
  744. /**
  745. * This field is the first SGL element pair found in the TC data structure.
  746. */
  747. struct scu_sgl_element_pair sgl_pair_ab;
  748. /* OFFSET 0x80-0x9C */
  749. /**
  750. * This field is the second SGL element pair found in the TC data structure.
  751. */
  752. struct scu_sgl_element_pair sgl_pair_cd;
  753. /* OFFSET 0xA0-BC */
  754. struct scu_sgl_element_pair sgl_snapshot_ac;
  755. /* OFFSET 0xC0 */
  756. u32 active_sgl_element_pair; /* read only set to 0 */
  757. /* OFFSET 0xC4-0xCC */
  758. u32 reserved_C4_CC[3];
  759. /* OFFSET 0xD0 */
  760. u32 intermediate_crc_value:16;
  761. u32 initial_crc_seed:16;
  762. /* OFFSET 0xD4 */
  763. u32 application_tag_for_verify:16;
  764. u32 application_tag_for_generate:16;
  765. /* OFFSET 0xD8 */
  766. u32 reference_tag_seed_for_verify_function;
  767. /* OFFSET 0xDC */
  768. u32 reserved_DC;
  769. /* OFFSET 0xE0 */
  770. u32 reserved_E0_0:16;
  771. u32 application_tag_mask_for_generate:16;
  772. /* OFFSET 0xE4 */
  773. u32 block_protection_control:16;
  774. u32 application_tag_mask_for_verify:16;
  775. /* OFFSET 0xE8 */
  776. u32 block_protection_error:8;
  777. u32 reserved_E8_0:24;
  778. /* OFFSET 0xEC */
  779. u32 reference_tag_seed_for_verify;
  780. /* OFFSET 0xF0 */
  781. u32 intermediate_crc_valid_snapshot:16;
  782. u32 reserved_F0_0:16;
  783. /* OFFSET 0xF4 */
  784. u32 reference_tag_seed_for_verify_function_snapshot;
  785. /* OFFSET 0xF8 */
  786. u32 snapshot_of_reserved_dword_DC_of_tc;
  787. /* OFFSET 0xFC */
  788. u32 reference_tag_seed_for_generate_function_snapshot;
  789. };
  790. #endif /* _SCU_TASK_CONTEXT_H_ */