n2_core.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. #ifndef _N2_CORE_H
  2. #define _N2_CORE_H
  3. #ifndef __ASSEMBLY__
  4. struct ino_blob {
  5. u64 intr;
  6. u64 ino;
  7. };
  8. struct spu_mdesc_info {
  9. u64 cfg_handle;
  10. struct ino_blob *ino_table;
  11. int num_intrs;
  12. };
  13. struct n2_crypto {
  14. struct spu_mdesc_info cwq_info;
  15. struct list_head cwq_list;
  16. };
  17. struct n2_mau {
  18. struct spu_mdesc_info mau_info;
  19. struct list_head mau_list;
  20. };
  21. #define CWQ_ENTRY_SIZE 64
  22. #define CWQ_NUM_ENTRIES 64
  23. #define MAU_ENTRY_SIZE 64
  24. #define MAU_NUM_ENTRIES 64
  25. struct cwq_initial_entry {
  26. u64 control;
  27. u64 src_addr;
  28. u64 auth_key_addr;
  29. u64 auth_iv_addr;
  30. u64 final_auth_state_addr;
  31. u64 enc_key_addr;
  32. u64 enc_iv_addr;
  33. u64 dest_addr;
  34. };
  35. struct cwq_ext_entry {
  36. u64 len;
  37. u64 src_addr;
  38. u64 resv1;
  39. u64 resv2;
  40. u64 resv3;
  41. u64 resv4;
  42. u64 resv5;
  43. u64 resv6;
  44. };
  45. struct cwq_final_entry {
  46. u64 control;
  47. u64 src_addr;
  48. u64 resv1;
  49. u64 resv2;
  50. u64 resv3;
  51. u64 resv4;
  52. u64 resv5;
  53. u64 resv6;
  54. };
  55. #define CONTROL_LEN 0x000000000000ffffULL
  56. #define CONTROL_LEN_SHIFT 0
  57. #define CONTROL_HMAC_KEY_LEN 0x0000000000ff0000ULL
  58. #define CONTROL_HMAC_KEY_LEN_SHIFT 16
  59. #define CONTROL_ENC_TYPE 0x00000000ff000000ULL
  60. #define CONTROL_ENC_TYPE_SHIFT 24
  61. #define ENC_TYPE_ALG_RC4_STREAM 0x00ULL
  62. #define ENC_TYPE_ALG_RC4_NOSTREAM 0x04ULL
  63. #define ENC_TYPE_ALG_DES 0x08ULL
  64. #define ENC_TYPE_ALG_3DES 0x0cULL
  65. #define ENC_TYPE_ALG_AES128 0x10ULL
  66. #define ENC_TYPE_ALG_AES192 0x14ULL
  67. #define ENC_TYPE_ALG_AES256 0x18ULL
  68. #define ENC_TYPE_ALG_RESERVED 0x1cULL
  69. #define ENC_TYPE_ALG_MASK 0x1cULL
  70. #define ENC_TYPE_CHAINING_ECB 0x00ULL
  71. #define ENC_TYPE_CHAINING_CBC 0x01ULL
  72. #define ENC_TYPE_CHAINING_CFB 0x02ULL
  73. #define ENC_TYPE_CHAINING_COUNTER 0x03ULL
  74. #define ENC_TYPE_CHAINING_MASK 0x03ULL
  75. #define CONTROL_AUTH_TYPE 0x0000001f00000000ULL
  76. #define CONTROL_AUTH_TYPE_SHIFT 32
  77. #define AUTH_TYPE_RESERVED 0x00ULL
  78. #define AUTH_TYPE_MD5 0x01ULL
  79. #define AUTH_TYPE_SHA1 0x02ULL
  80. #define AUTH_TYPE_SHA256 0x03ULL
  81. #define AUTH_TYPE_CRC32 0x04ULL
  82. #define AUTH_TYPE_HMAC_MD5 0x05ULL
  83. #define AUTH_TYPE_HMAC_SHA1 0x06ULL
  84. #define AUTH_TYPE_HMAC_SHA256 0x07ULL
  85. #define AUTH_TYPE_TCP_CHECKSUM 0x08ULL
  86. #define AUTH_TYPE_SSL_HMAC_MD5 0x09ULL
  87. #define AUTH_TYPE_SSL_HMAC_SHA1 0x0aULL
  88. #define AUTH_TYPE_SSL_HMAC_SHA256 0x0bULL
  89. #define CONTROL_STRAND 0x000000e000000000ULL
  90. #define CONTROL_STRAND_SHIFT 37
  91. #define CONTROL_HASH_LEN 0x0000ff0000000000ULL
  92. #define CONTROL_HASH_LEN_SHIFT 40
  93. #define CONTROL_INTERRUPT 0x0001000000000000ULL
  94. #define CONTROL_STORE_FINAL_AUTH_STATE 0x0002000000000000ULL
  95. #define CONTROL_RESERVED 0x001c000000000000ULL
  96. #define CONTROL_HV_DONE 0x0004000000000000ULL
  97. #define CONTROL_HV_PROTOCOL_ERROR 0x0008000000000000ULL
  98. #define CONTROL_HV_HARDWARE_ERROR 0x0010000000000000ULL
  99. #define CONTROL_END_OF_BLOCK 0x0020000000000000ULL
  100. #define CONTROL_START_OF_BLOCK 0x0040000000000000ULL
  101. #define CONTROL_ENCRYPT 0x0080000000000000ULL
  102. #define CONTROL_OPCODE 0xff00000000000000ULL
  103. #define CONTROL_OPCODE_SHIFT 56
  104. #define OPCODE_INPLACE_BIT 0x80ULL
  105. #define OPCODE_SSL_KEYBLOCK 0x10ULL
  106. #define OPCODE_COPY 0x20ULL
  107. #define OPCODE_ENCRYPT 0x40ULL
  108. #define OPCODE_AUTH_MAC 0x41ULL
  109. #endif /* !(__ASSEMBLY__) */
  110. /* NCS v2.0 hypervisor interfaces */
  111. #define HV_NCS_QTYPE_MAU 0x01
  112. #define HV_NCS_QTYPE_CWQ 0x02
  113. /* ncs_qconf()
  114. * TRAP: HV_FAST_TRAP
  115. * FUNCTION: HV_FAST_NCS_QCONF
  116. * ARG0: Queue type (HV_NCS_QTYPE_{MAU,CWQ})
  117. * ARG1: Real address of queue, or handle for unconfigure
  118. * ARG2: Number of entries in queue, zero for unconfigure
  119. * RET0: status
  120. * RET1: queue handle
  121. *
  122. * Configure a queue in the stream processing unit.
  123. *
  124. * The real address given as the base must be 64-byte
  125. * aligned.
  126. *
  127. * The queue size can range from a minimum of 2 to a maximum
  128. * of 64. The queue size must be a power of two.
  129. *
  130. * To unconfigure a queue, specify a length of zero and place
  131. * the queue handle into ARG1.
  132. *
  133. * On configure success the hypervisor will set the FIRST, HEAD,
  134. * and TAIL registers to the address of the first entry in the
  135. * queue. The LAST register will be set to point to the last
  136. * entry in the queue.
  137. */
  138. #define HV_FAST_NCS_QCONF 0x111
  139. /* ncs_qinfo()
  140. * TRAP: HV_FAST_TRAP
  141. * FUNCTION: HV_FAST_NCS_QINFO
  142. * ARG0: Queue handle
  143. * RET0: status
  144. * RET1: Queue type (HV_NCS_QTYPE_{MAU,CWQ})
  145. * RET2: Queue base address
  146. * RET3: Number of entries
  147. */
  148. #define HV_FAST_NCS_QINFO 0x112
  149. /* ncs_gethead()
  150. * TRAP: HV_FAST_TRAP
  151. * FUNCTION: HV_FAST_NCS_GETHEAD
  152. * ARG0: Queue handle
  153. * RET0: status
  154. * RET1: queue head offset
  155. */
  156. #define HV_FAST_NCS_GETHEAD 0x113
  157. /* ncs_gettail()
  158. * TRAP: HV_FAST_TRAP
  159. * FUNCTION: HV_FAST_NCS_GETTAIL
  160. * ARG0: Queue handle
  161. * RET0: status
  162. * RET1: queue tail offset
  163. */
  164. #define HV_FAST_NCS_GETTAIL 0x114
  165. /* ncs_settail()
  166. * TRAP: HV_FAST_TRAP
  167. * FUNCTION: HV_FAST_NCS_SETTAIL
  168. * ARG0: Queue handle
  169. * ARG1: New tail offset
  170. * RET0: status
  171. */
  172. #define HV_FAST_NCS_SETTAIL 0x115
  173. /* ncs_qhandle_to_devino()
  174. * TRAP: HV_FAST_TRAP
  175. * FUNCTION: HV_FAST_NCS_QHANDLE_TO_DEVINO
  176. * ARG0: Queue handle
  177. * RET0: status
  178. * RET1: devino
  179. */
  180. #define HV_FAST_NCS_QHANDLE_TO_DEVINO 0x116
  181. /* ncs_sethead_marker()
  182. * TRAP: HV_FAST_TRAP
  183. * FUNCTION: HV_FAST_NCS_SETHEAD_MARKER
  184. * ARG0: Queue handle
  185. * ARG1: New head offset
  186. * RET0: status
  187. */
  188. #define HV_FAST_NCS_SETHEAD_MARKER 0x117
  189. #ifndef __ASSEMBLY__
  190. extern unsigned long sun4v_ncs_qconf(unsigned long queue_type,
  191. unsigned long queue_ra,
  192. unsigned long num_entries,
  193. unsigned long *qhandle);
  194. extern unsigned long sun4v_ncs_qinfo(unsigned long qhandle,
  195. unsigned long *queue_type,
  196. unsigned long *queue_ra,
  197. unsigned long *num_entries);
  198. extern unsigned long sun4v_ncs_gethead(unsigned long qhandle,
  199. unsigned long *head);
  200. extern unsigned long sun4v_ncs_gettail(unsigned long qhandle,
  201. unsigned long *tail);
  202. extern unsigned long sun4v_ncs_settail(unsigned long qhandle,
  203. unsigned long tail);
  204. extern unsigned long sun4v_ncs_qhandle_to_devino(unsigned long qhandle,
  205. unsigned long *devino);
  206. extern unsigned long sun4v_ncs_sethead_marker(unsigned long qhandle,
  207. unsigned long head);
  208. #endif /* !(__ASSEMBLY__) */
  209. #endif /* _N2_CORE_H */