mpipe_shm.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. /*
  2. * Copyright 2012 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. /* Machine-generated file; do not edit. */
  15. #ifndef __ARCH_MPIPE_SHM_H__
  16. #define __ARCH_MPIPE_SHM_H__
  17. #include <arch/abi.h>
  18. #include <arch/mpipe_shm_def.h>
  19. #ifndef __ASSEMBLER__
  20. /**
  21. * MPIPE eDMA Descriptor.
  22. * The eDMA descriptor is written by software and consumed by hardware. It
  23. * is used to specify the location of egress packet data to be sent out of
  24. * the chip via one of the packet interfaces.
  25. */
  26. __extension__
  27. typedef union
  28. {
  29. struct
  30. {
  31. /* Word 0 */
  32. #ifndef __BIG_ENDIAN__
  33. /**
  34. * Generation number. Used to indicate a valid descriptor in ring. When
  35. * a new descriptor is written into the ring, software must toggle this
  36. * bit. The net effect is that the GEN bit being written into new
  37. * descriptors toggles each time the ring tail pointer wraps.
  38. */
  39. uint_reg_t gen : 1;
  40. /**
  41. * For devices with EDMA reorder support, this field allows the
  42. * descriptor to select the egress FIFO. The associated DMA ring must
  43. * have ALLOW_EFIFO_SEL enabled.
  44. */
  45. uint_reg_t efifo_sel : 6;
  46. /** Reserved. Must be zero. */
  47. uint_reg_t r0 : 1;
  48. /** Checksum generation enabled for this transfer. */
  49. uint_reg_t csum : 1;
  50. /**
  51. * Nothing to be sent. Used, for example, when software has dropped a
  52. * packet but still wishes to return all of the associated buffers.
  53. */
  54. uint_reg_t ns : 1;
  55. /**
  56. * Notification interrupt will be delivered when packet has been egressed.
  57. */
  58. uint_reg_t notif : 1;
  59. /**
  60. * Boundary indicator. When 1, this transfer includes the EOP for this
  61. * command. Must be clear on all but the last descriptor for an egress
  62. * packet.
  63. */
  64. uint_reg_t bound : 1;
  65. /** Reserved. Must be zero. */
  66. uint_reg_t r1 : 4;
  67. /**
  68. * Number of bytes to be sent for this descriptor. When zero, no data
  69. * will be moved and the buffer descriptor will be ignored. If the
  70. * buffer descriptor indicates that it is chained, the low 7 bits of the
  71. * VA indicate the offset within the first buffer (e.g. 127 bytes is the
  72. * maximum offset into the first buffer). If the size exceeds a single
  73. * buffer, subsequent buffer descriptors will be fetched prior to
  74. * processing the next eDMA descriptor in the ring.
  75. */
  76. uint_reg_t xfer_size : 14;
  77. /** Reserved. Must be zero. */
  78. uint_reg_t r2 : 2;
  79. /**
  80. * Destination of checksum relative to CSUM_START relative to the first
  81. * byte moved by this descriptor. Must be zero if CSUM=0 in this
  82. * descriptor. Must be less than XFER_SIZE (e.g. the first byte of the
  83. * CSUM_DEST must be within the span of this descriptor).
  84. */
  85. uint_reg_t csum_dest : 8;
  86. /**
  87. * Start byte of checksum relative to the first byte moved by this
  88. * descriptor. If this is not the first descriptor for the egress
  89. * packet, CSUM_START is still relative to the first byte in this
  90. * descriptor. Must be zero if CSUM=0 in this descriptor.
  91. */
  92. uint_reg_t csum_start : 8;
  93. /**
  94. * Initial value for 16-bit 1's compliment checksum if enabled via CSUM.
  95. * Specified in network order. That is, bits[7:0] will be added to the
  96. * byte pointed to by CSUM_START and bits[15:8] will be added to the byte
  97. * pointed to by CSUM_START+1 (with appropriate 1's compliment carries).
  98. * Must be zero if CSUM=0 in this descriptor.
  99. */
  100. uint_reg_t csum_seed : 16;
  101. #else /* __BIG_ENDIAN__ */
  102. uint_reg_t csum_seed : 16;
  103. uint_reg_t csum_start : 8;
  104. uint_reg_t csum_dest : 8;
  105. uint_reg_t r2 : 2;
  106. uint_reg_t xfer_size : 14;
  107. uint_reg_t r1 : 4;
  108. uint_reg_t bound : 1;
  109. uint_reg_t notif : 1;
  110. uint_reg_t ns : 1;
  111. uint_reg_t csum : 1;
  112. uint_reg_t r0 : 1;
  113. uint_reg_t efifo_sel : 6;
  114. uint_reg_t gen : 1;
  115. #endif
  116. /* Word 1 */
  117. #ifndef __BIG_ENDIAN__
  118. /** Virtual address. Must be sign extended by consumer. */
  119. int_reg_t va : 42;
  120. /** Reserved. */
  121. uint_reg_t __reserved_0 : 6;
  122. /** Index of the buffer stack to which this buffer belongs. */
  123. uint_reg_t stack_idx : 5;
  124. /** Reserved. */
  125. uint_reg_t __reserved_1 : 3;
  126. /**
  127. * Instance ID. For devices that support automatic buffer return between
  128. * mPIPE instances, this field indicates the buffer owner. If the INST
  129. * field does not match the mPIPE's instance number when a packet is
  130. * egressed, buffers with HWB set will be returned to the other mPIPE
  131. * instance. Note that not all devices support multi-mPIPE buffer
  132. * return. The MPIPE_EDMA_INFO.REMOTE_BUFF_RTN_SUPPORT bit indicates
  133. * whether the INST field in the buffer descriptor is populated by iDMA
  134. * hardware.
  135. */
  136. uint_reg_t inst : 2;
  137. /**
  138. * Always set to one by hardware in iDMA packet descriptors. For eDMA,
  139. * indicates whether the buffer will be released to the buffer stack
  140. * manager. When 0, software is responsible for releasing the buffer.
  141. */
  142. uint_reg_t hwb : 1;
  143. /**
  144. * Encoded size of buffer. Set by the ingress hardware for iDMA packet
  145. * descriptors. For eDMA descriptors, indicates the buffer size if .c
  146. * indicates a chained packet. If an eDMA descriptor is not chained and
  147. * the .hwb bit is not set, this field is ignored and the size is
  148. * specified by the .xfer_size field.
  149. * 0 = 128 bytes
  150. * 1 = 256 bytes
  151. * 2 = 512 bytes
  152. * 3 = 1024 bytes
  153. * 4 = 1664 bytes
  154. * 5 = 4096 bytes
  155. * 6 = 10368 bytes
  156. * 7 = 16384 bytes
  157. */
  158. uint_reg_t size : 3;
  159. /**
  160. * Chaining configuration for the buffer. Indicates that an ingress
  161. * packet or egress command is chained across multiple buffers, with each
  162. * buffer's size indicated by the .size field.
  163. */
  164. uint_reg_t c : 2;
  165. #else /* __BIG_ENDIAN__ */
  166. uint_reg_t c : 2;
  167. uint_reg_t size : 3;
  168. uint_reg_t hwb : 1;
  169. uint_reg_t inst : 2;
  170. uint_reg_t __reserved_1 : 3;
  171. uint_reg_t stack_idx : 5;
  172. uint_reg_t __reserved_0 : 6;
  173. int_reg_t va : 42;
  174. #endif
  175. };
  176. /** Word access */
  177. uint_reg_t words[2];
  178. } MPIPE_EDMA_DESC_t;
  179. /**
  180. * MPIPE Packet Descriptor.
  181. * The packet descriptor is filled by the mPIPE's classification,
  182. * load-balancing, and buffer management services. Some fields are consumed
  183. * by mPIPE hardware, and others are consumed by Tile software.
  184. */
  185. __extension__
  186. typedef union
  187. {
  188. struct
  189. {
  190. /* Word 0 */
  191. #ifndef __BIG_ENDIAN__
  192. /**
  193. * Notification ring into which this packet descriptor is written.
  194. * Typically written by load balancer, but can be overridden by
  195. * classification program if NR is asserted.
  196. */
  197. uint_reg_t notif_ring : 8;
  198. /** Source channel for this packet. Written by mPIPE DMA hardware. */
  199. uint_reg_t channel : 5;
  200. /** Reserved. */
  201. uint_reg_t __reserved_0 : 1;
  202. /**
  203. * MAC Error.
  204. * Generated by the MAC interface. Asserted if there was an overrun of
  205. * the MAC's receive FIFO. This condition generally only occurs if the
  206. * mPIPE clock is running too slowly.
  207. */
  208. uint_reg_t me : 1;
  209. /**
  210. * Truncation Error.
  211. * Written by the iDMA hardware. Asserted if packet was truncated due to
  212. * insufficient space in iPkt buffer
  213. */
  214. uint_reg_t tr : 1;
  215. /**
  216. * Written by the iDMA hardware. Indicates the number of bytes written
  217. * to Tile memory. In general, this is the actual size of the packet as
  218. * received from the MAC. But if the packet is truncated due to running
  219. * out of buffers or due to the iPkt buffer filling up, then the L2_SIZE
  220. * will be reduced to reflect the actual number of valid bytes written to
  221. * Tile memory.
  222. */
  223. uint_reg_t l2_size : 14;
  224. /**
  225. * CRC Error.
  226. * Generated by the MAC. Asserted if MAC indicated an L2 CRC error or
  227. * other L2 error (bad length etc.) on the packet.
  228. */
  229. uint_reg_t ce : 1;
  230. /**
  231. * Cut Through.
  232. * Written by the iDMA hardware. Asserted if packet was not completely
  233. * received before being sent to classifier. L2_Size will indicate
  234. * number of bytes received so far.
  235. */
  236. uint_reg_t ct : 1;
  237. /**
  238. * Written by the classification program. Used by the load balancer to
  239. * select the ring into which this packet descriptor is written.
  240. */
  241. uint_reg_t bucket_id : 13;
  242. /** Reserved. */
  243. uint_reg_t __reserved_1 : 3;
  244. /**
  245. * Checksum.
  246. * Written by classification program. When 1, the checksum engine will
  247. * perform checksum based on the CSUM_SEED, CSUM_START, and CSUM_BYTES
  248. * fields. The result will be placed in CSUM_VAL.
  249. */
  250. uint_reg_t cs : 1;
  251. /**
  252. * Notification Ring Select.
  253. * Written by the classification program. When 1, the NotifRingIDX is
  254. * set by classification program rather than being set by load balancer.
  255. */
  256. uint_reg_t nr : 1;
  257. /**
  258. * Written by classification program. Indicates whether packet and
  259. * descriptor should both be dropped, both be delivered, or only the
  260. * descriptor should be delivered.
  261. */
  262. uint_reg_t dest : 2;
  263. /**
  264. * General Purpose Sequence Number Enable.
  265. * Written by the classification program. When 1, the GP_SQN_SEL field
  266. * contains the sequence number selector and the GP_SQN field will be
  267. * replaced with the associated sequence number. When clear, the GP_SQN
  268. * field is left intact and be used as "Custom" bytes.
  269. */
  270. uint_reg_t sq : 1;
  271. /**
  272. * TimeStamp Enable.
  273. * Enable TimeStamp insertion. When clear, timestamp field may be filled
  274. * with custom data by classifier. When set, hardware inserts the
  275. * timestamp when the start of packet is received from the MAC.
  276. */
  277. uint_reg_t ts : 1;
  278. /**
  279. * Packet Sequence Number Enable.
  280. * Enable PacketSQN insertion. When clear, PacketSQN field may be filled
  281. * with custom data by classifier. When set, hardware inserts the packet
  282. * sequence number when the packet descriptor is written to a
  283. * notification ring.
  284. */
  285. uint_reg_t ps : 1;
  286. /**
  287. * Buffer Error.
  288. * Written by the iDMA hardware. Asserted if iDMA ran out of buffers
  289. * while writing the packet. Software must still return any buffer
  290. * descriptors whose C field indicates a valid descriptor was consumed.
  291. */
  292. uint_reg_t be : 1;
  293. /**
  294. * Written by the classification program. The associated counter is
  295. * incremented when the packet is sent.
  296. */
  297. uint_reg_t ctr0 : 5;
  298. /** Reserved. */
  299. uint_reg_t __reserved_2 : 3;
  300. #else /* __BIG_ENDIAN__ */
  301. uint_reg_t __reserved_2 : 3;
  302. uint_reg_t ctr0 : 5;
  303. uint_reg_t be : 1;
  304. uint_reg_t ps : 1;
  305. uint_reg_t ts : 1;
  306. uint_reg_t sq : 1;
  307. uint_reg_t dest : 2;
  308. uint_reg_t nr : 1;
  309. uint_reg_t cs : 1;
  310. uint_reg_t __reserved_1 : 3;
  311. uint_reg_t bucket_id : 13;
  312. uint_reg_t ct : 1;
  313. uint_reg_t ce : 1;
  314. uint_reg_t l2_size : 14;
  315. uint_reg_t tr : 1;
  316. uint_reg_t me : 1;
  317. uint_reg_t __reserved_0 : 1;
  318. uint_reg_t channel : 5;
  319. uint_reg_t notif_ring : 8;
  320. #endif
  321. /* Word 1 */
  322. #ifndef __BIG_ENDIAN__
  323. /**
  324. * Written by the classification program. The associated counter is
  325. * incremented when the packet is sent.
  326. */
  327. uint_reg_t ctr1 : 5;
  328. /** Reserved. */
  329. uint_reg_t __reserved_3 : 3;
  330. /**
  331. * Written by classification program. Indicates the start byte for
  332. * checksum. Relative to 1st byte received from MAC.
  333. */
  334. uint_reg_t csum_start : 8;
  335. /**
  336. * Checksum seed written by classification program. Overwritten with
  337. * resultant checksum if CS bit is asserted. The endianness of the CSUM
  338. * value bits when viewed by Tile software match the packet byte order.
  339. * That is, bits[7:0] of the resulting checksum value correspond to
  340. * earlier (more significant) bytes in the packet. To avoid classifier
  341. * software from having to byte swap the CSUM_SEED, the iDMA checksum
  342. * engine byte swaps the classifier's result before seeding the checksum
  343. * calculation. Thus, the CSUM_START byte of packet data is added to
  344. * bits[15:8] of the CSUM_SEED field generated by the classifier. This
  345. * byte swap will be visible to Tile software if the CS bit is clear.
  346. */
  347. uint_reg_t csum_seed_val : 16;
  348. /**
  349. * Written by the classification program. Not interpreted by mPIPE
  350. * hardware.
  351. */
  352. uint_reg_t custom0 : 32;
  353. #else /* __BIG_ENDIAN__ */
  354. uint_reg_t custom0 : 32;
  355. uint_reg_t csum_seed_val : 16;
  356. uint_reg_t csum_start : 8;
  357. uint_reg_t __reserved_3 : 3;
  358. uint_reg_t ctr1 : 5;
  359. #endif
  360. /* Word 2 */
  361. #ifndef __BIG_ENDIAN__
  362. /**
  363. * Written by the classification program. Not interpreted by mPIPE
  364. * hardware.
  365. */
  366. uint_reg_t custom1 : 64;
  367. #else /* __BIG_ENDIAN__ */
  368. uint_reg_t custom1 : 64;
  369. #endif
  370. /* Word 3 */
  371. #ifndef __BIG_ENDIAN__
  372. /**
  373. * Written by the classification program. Not interpreted by mPIPE
  374. * hardware.
  375. */
  376. uint_reg_t custom2 : 64;
  377. #else /* __BIG_ENDIAN__ */
  378. uint_reg_t custom2 : 64;
  379. #endif
  380. /* Word 4 */
  381. #ifndef __BIG_ENDIAN__
  382. /**
  383. * Written by the classification program. Not interpreted by mPIPE
  384. * hardware.
  385. */
  386. uint_reg_t custom3 : 64;
  387. #else /* __BIG_ENDIAN__ */
  388. uint_reg_t custom3 : 64;
  389. #endif
  390. /* Word 5 */
  391. #ifndef __BIG_ENDIAN__
  392. /**
  393. * Sequence number applied when packet is distributed. Classifier
  394. * selects which sequence number is to be applied by writing the 13-bit
  395. * SQN-selector into this field. For devices that support EXT_SQN (as
  396. * indicated in IDMA_INFO.EXT_SQN_SUPPORT), the GP_SQN can be extended to
  397. * 32-bits via the IDMA_CTL.EXT_SQN register. In this case the
  398. * PACKET_SQN will be reduced to 32 bits.
  399. */
  400. uint_reg_t gp_sqn : 16;
  401. /**
  402. * Written by notification hardware. The packet sequence number is
  403. * incremented for each packet that wasn't dropped.
  404. */
  405. uint_reg_t packet_sqn : 48;
  406. #else /* __BIG_ENDIAN__ */
  407. uint_reg_t packet_sqn : 48;
  408. uint_reg_t gp_sqn : 16;
  409. #endif
  410. /* Word 6 */
  411. #ifndef __BIG_ENDIAN__
  412. /**
  413. * Written by hardware when the start-of-packet is received by the mPIPE
  414. * from the MAC. This is the nanoseconds part of the packet timestamp.
  415. */
  416. uint_reg_t time_stamp_ns : 32;
  417. /**
  418. * Written by hardware when the start-of-packet is received by the mPIPE
  419. * from the MAC. This is the seconds part of the packet timestamp.
  420. */
  421. uint_reg_t time_stamp_sec : 32;
  422. #else /* __BIG_ENDIAN__ */
  423. uint_reg_t time_stamp_sec : 32;
  424. uint_reg_t time_stamp_ns : 32;
  425. #endif
  426. /* Word 7 */
  427. #ifndef __BIG_ENDIAN__
  428. /** Virtual address. Must be sign extended by consumer. */
  429. int_reg_t va : 42;
  430. /** Reserved. */
  431. uint_reg_t __reserved_4 : 6;
  432. /** Index of the buffer stack to which this buffer belongs. */
  433. uint_reg_t stack_idx : 5;
  434. /** Reserved. */
  435. uint_reg_t __reserved_5 : 3;
  436. /**
  437. * Instance ID. For devices that support automatic buffer return between
  438. * mPIPE instances, this field indicates the buffer owner. If the INST
  439. * field does not match the mPIPE's instance number when a packet is
  440. * egressed, buffers with HWB set will be returned to the other mPIPE
  441. * instance. Note that not all devices support multi-mPIPE buffer
  442. * return. The MPIPE_EDMA_INFO.REMOTE_BUFF_RTN_SUPPORT bit indicates
  443. * whether the INST field in the buffer descriptor is populated by iDMA
  444. * hardware.
  445. */
  446. uint_reg_t inst : 2;
  447. /**
  448. * Always set to one by hardware in iDMA packet descriptors. For eDMA,
  449. * indicates whether the buffer will be released to the buffer stack
  450. * manager. When 0, software is responsible for releasing the buffer.
  451. */
  452. uint_reg_t hwb : 1;
  453. /**
  454. * Encoded size of buffer. Set by the ingress hardware for iDMA packet
  455. * descriptors. For eDMA descriptors, indicates the buffer size if .c
  456. * indicates a chained packet. If an eDMA descriptor is not chained and
  457. * the .hwb bit is not set, this field is ignored and the size is
  458. * specified by the .xfer_size field.
  459. * 0 = 128 bytes
  460. * 1 = 256 bytes
  461. * 2 = 512 bytes
  462. * 3 = 1024 bytes
  463. * 4 = 1664 bytes
  464. * 5 = 4096 bytes
  465. * 6 = 10368 bytes
  466. * 7 = 16384 bytes
  467. */
  468. uint_reg_t size : 3;
  469. /**
  470. * Chaining configuration for the buffer. Indicates that an ingress
  471. * packet or egress command is chained across multiple buffers, with each
  472. * buffer's size indicated by the .size field.
  473. */
  474. uint_reg_t c : 2;
  475. #else /* __BIG_ENDIAN__ */
  476. uint_reg_t c : 2;
  477. uint_reg_t size : 3;
  478. uint_reg_t hwb : 1;
  479. uint_reg_t inst : 2;
  480. uint_reg_t __reserved_5 : 3;
  481. uint_reg_t stack_idx : 5;
  482. uint_reg_t __reserved_4 : 6;
  483. int_reg_t va : 42;
  484. #endif
  485. };
  486. /** Word access */
  487. uint_reg_t words[8];
  488. } MPIPE_PDESC_t;
  489. #endif /* !defined(__ASSEMBLER__) */
  490. #endif /* !defined(__ARCH_MPIPE_SHM_H__) */