mpipe_shm.h 17 KB

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