iorpc.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714
  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. #ifndef _HV_IORPC_H_
  15. #define _HV_IORPC_H_
  16. /**
  17. *
  18. * Error codes and struct definitions for the IO RPC library.
  19. *
  20. * The hypervisor's IO RPC component provides a convenient way for
  21. * driver authors to proxy system calls between user space, linux, and
  22. * the hypervisor driver. The core of the system is a set of Python
  23. * files that take ".idl" files as input and generates the following
  24. * source code:
  25. *
  26. * - _rpc_call() routines for use in userspace IO libraries. These
  27. * routines take an argument list specified in the .idl file, pack the
  28. * arguments in to a buffer, and read or write that buffer via the
  29. * Linux iorpc driver.
  30. *
  31. * - dispatch_read() and dispatch_write() routines that hypervisor
  32. * drivers can use to implement most of their dev_pread() and
  33. * dev_pwrite() methods. These routines decode the incoming parameter
  34. * blob, permission check and translate parameters where appropriate,
  35. * and then invoke a callback routine for whichever RPC call has
  36. * arrived. The driver simply implements the set of callback
  37. * routines.
  38. *
  39. * The IO RPC system also includes the Linux 'iorpc' driver, which
  40. * proxies calls between the userspace library and the hypervisor
  41. * driver. The Linux driver is almost entirely device agnostic; it
  42. * watches for special flags indicating cases where a memory buffer
  43. * address might need to be translated, etc. As a result, driver
  44. * writers can avoid many of the problem cases related to registering
  45. * hardware resources like memory pages or interrupts. However, the
  46. * drivers must be careful to obey the conventions documented below in
  47. * order to work properly with the generic Linux iorpc driver.
  48. *
  49. * @section iorpc_domains Service Domains
  50. *
  51. * All iorpc-based drivers must support a notion of service domains.
  52. * A service domain is basically an application context - state
  53. * indicating resources that are allocated to that particular app
  54. * which it may access and (perhaps) other applications may not
  55. * access. Drivers can support any number of service domains they
  56. * choose. In some cases the design is limited by a number of service
  57. * domains supported by the IO hardware; in other cases the service
  58. * domains are a purely software concept and the driver chooses a
  59. * maximum number of domains based on how much state memory it is
  60. * willing to preallocate.
  61. *
  62. * For example, the mPIPE driver only supports as many service domains
  63. * as are supported by the mPIPE hardware. This limitation is
  64. * required because the hardware implements its own MMIO protection
  65. * scheme to allow large MMIO mappings while still protecting small
  66. * register ranges within the page that should only be accessed by the
  67. * hypervisor.
  68. *
  69. * In contrast, drivers with no hardware service domain limitations
  70. * (for instance the TRIO shim) can implement an arbitrary number of
  71. * service domains. In these cases, each service domain is limited to
  72. * a carefully restricted set of legal MMIO addresses if necessary to
  73. * keep one application from corrupting another application's state.
  74. *
  75. * @section iorpc_conventions System Call Conventions
  76. *
  77. * The driver's open routine is responsible for allocating a new
  78. * service domain for each hv_dev_open() call. By convention, the
  79. * return value from open() should be the service domain number on
  80. * success, or GXIO_ERR_NO_SVC_DOM if no more service domains are
  81. * available.
  82. *
  83. * The implementations of hv_dev_pread() and hv_dev_pwrite() are
  84. * responsible for validating the devhdl value passed up by the
  85. * client. Since the device handle returned by hv_dev_open() should
  86. * embed the positive service domain number, drivers should make sure
  87. * that DRV_HDL2BITS(devhdl) is a legal service domain. If the client
  88. * passes an illegal service domain number, the routine should return
  89. * GXIO_ERR_INVAL_SVC_DOM. Once the service domain number has been
  90. * validated, the driver can copy to/from the client buffer and call
  91. * the dispatch_read() or dispatch_write() methods created by the RPC
  92. * generator.
  93. *
  94. * The hv_dev_close() implementation should reset all service domain
  95. * state and put the service domain back on a free list for
  96. * reallocation by a future application. In most cases, this will
  97. * require executing a hardware reset or drain flow and denying any
  98. * MMIO regions that were created for the service domain.
  99. *
  100. * @section iorpc_data Special Data Types
  101. *
  102. * The .idl file syntax allows the creation of syscalls with special
  103. * parameters that require permission checks or translations as part
  104. * of the system call path. Because of limitations in the code
  105. * generator, APIs are generally limited to just one of these special
  106. * parameters per system call, and they are sometimes required to be
  107. * the first or last parameter to the call. Special parameters
  108. * include:
  109. *
  110. * @subsection iorpc_mem_buffer MEM_BUFFER
  111. *
  112. * The MEM_BUFFER() datatype allows user space to "register" memory
  113. * buffers with a device. Registering memory accomplishes two tasks:
  114. * Linux keeps track of all buffers that might be modified by a
  115. * hardware device, and the hardware device drivers bind registered
  116. * buffers to particular hardware resources like ingress NotifRings.
  117. * The MEM_BUFFER() idl syntax can take extra flags like ALIGN_64KB,
  118. * ALIGN_SELF_SIZE, and FLAGS indicating that memory buffers must have
  119. * certain alignment or that the user should be able to pass a "memory
  120. * flags" word specifying attributes like nt_hint or IO cache pinning.
  121. * The parser will accept multiple MEM_BUFFER() flags.
  122. *
  123. * Implementations must obey the following conventions when
  124. * registering memory buffers via the iorpc flow. These rules are a
  125. * result of the Linux driver implementation, which needs to keep
  126. * track of how many times a particular page has been registered with
  127. * the hardware so that it can release the page when all those
  128. * registrations are cleared.
  129. *
  130. * - Memory registrations that refer to a resource which has already
  131. * been bound must return GXIO_ERR_ALREADY_INIT. Thus, it is an
  132. * error to register memory twice without resetting (i.e. closing) the
  133. * resource in between. This convention keeps the Linux driver from
  134. * having to track which particular devices a page is bound to.
  135. *
  136. * - At present, a memory registration is only cleared when the
  137. * service domain is reset. In this case, the Linux driver simply
  138. * closes the HV device file handle and then decrements the reference
  139. * counts of all pages that were previously registered with the
  140. * device.
  141. *
  142. * - In the future, we may add a mechanism for unregistering memory.
  143. * One possible implementation would require that the user specify
  144. * which buffer is currently registered. The HV would then verify
  145. * that that page was actually the one currently mapped and return
  146. * success or failure to Linux, which would then only decrement the
  147. * page reference count if the addresses were mapped. Another scheme
  148. * might allow Linux to pass a token to the HV to be returned when the
  149. * resource is unmapped.
  150. *
  151. * @subsection iorpc_interrupt INTERRUPT
  152. *
  153. * The INTERRUPT .idl datatype allows the client to bind hardware
  154. * interrupts to a particular combination of IPI parameters - CPU, IPI
  155. * PL, and event bit number. This data is passed via a special
  156. * datatype so that the Linux driver can validate the CPU and PL and
  157. * the HV generic iorpc code can translate client CPUs to real CPUs.
  158. *
  159. * @subsection iorpc_pollfd_setup POLLFD_SETUP
  160. *
  161. * The POLLFD_SETUP .idl datatype allows the client to set up hardware
  162. * interrupt bindings which are received by Linux but which are made
  163. * visible to user processes as state transitions on a file descriptor;
  164. * this allows user processes to use Linux primitives, such as poll(), to
  165. * await particular hardware events. This data is passed via a special
  166. * datatype so that the Linux driver may recognize the pollable file
  167. * descriptor and translate it to a set of interrupt target information,
  168. * and so that the HV generic iorpc code can translate client CPUs to real
  169. * CPUs.
  170. *
  171. * @subsection iorpc_pollfd POLLFD
  172. *
  173. * The POLLFD .idl datatype allows manipulation of hardware interrupt
  174. * bindings set up via the POLLFD_SETUP datatype; common operations are
  175. * resetting the state of the requested interrupt events, and unbinding any
  176. * bound interrupts. This data is passed via a special datatype so that
  177. * the Linux driver may recognize the pollable file descriptor and
  178. * translate it to an interrupt identifier previously supplied by the
  179. * hypervisor as the result of an earlier pollfd_setup operation.
  180. *
  181. * @subsection iorpc_blob BLOB
  182. *
  183. * The BLOB .idl datatype allows the client to write an arbitrary
  184. * length string of bytes up to the hypervisor driver. This can be
  185. * useful for passing up large, arbitrarily structured data like
  186. * classifier programs. The iorpc stack takes care of validating the
  187. * buffer VA and CPA as the data passes up to the hypervisor. Unlike
  188. * MEM_BUFFER(), the buffer is not registered - Linux does not bump
  189. * page refcounts and the HV driver should not reuse the buffer once
  190. * the system call is complete.
  191. *
  192. * @section iorpc_translation Translating User Space Calls
  193. *
  194. * The ::iorpc_offset structure describes the formatting of the offset
  195. * that is passed to pread() or pwrite() as part of the generated RPC code.
  196. * When the user calls up to Linux, the rpc code fills in all the fields of
  197. * the offset, including a 16-bit opcode, a 16 bit format indicator, and 32
  198. * bits of user-specified "sub-offset". The opcode indicates which syscall
  199. * is being requested. The format indicates whether there is a "prefix
  200. * struct" at the start of the memory buffer passed to pwrite(), and if so
  201. * what data is in that prefix struct. These prefix structs are used to
  202. * implement special datatypes like MEM_BUFFER() and INTERRUPT - we arrange
  203. * to put data that needs translation and permission checks at the start of
  204. * the buffer so that the Linux driver and generic portions of the HV iorpc
  205. * code can easily access the data. The 32 bits of user-specified
  206. * "sub-offset" are most useful for pread() calls where the user needs to
  207. * also pass in a few bits indicating which register to read, etc.
  208. *
  209. * The Linux iorpc driver watches for system calls that contain prefix
  210. * structs so that it can translate parameters and bump reference
  211. * counts as appropriate. It does not (currently) have any knowledge
  212. * of the per-device opcodes - it doesn't care what operation you're
  213. * doing to mPIPE, so long as it can do all the generic book-keeping.
  214. * The hv/iorpc.h header file defines all of the generic encoding bits
  215. * needed to translate iorpc calls without knowing which particular
  216. * opcode is being issued.
  217. *
  218. * @section iorpc_globals Global iorpc Calls
  219. *
  220. * Implementing mmap() required adding some special iorpc syscalls
  221. * that are only called by the Linux driver, never by userspace.
  222. * These include get_mmio_base() and check_mmio_offset(). These
  223. * routines are described in globals.idl and must be included in every
  224. * iorpc driver. By providing these routines in every driver, Linux's
  225. * mmap implementation can easily get the PTE bits it needs and
  226. * validate the PA offset without needing to know the per-device
  227. * opcodes to perform those tasks.
  228. *
  229. * @section iorpc_kernel Supporting gxio APIs in the Kernel
  230. *
  231. * The iorpc code generator also supports generation of kernel code
  232. * implementing the gxio APIs. This capability is currently used by
  233. * the mPIPE network driver, and will likely be used by the TRIO root
  234. * complex and endpoint drivers and perhaps an in-kernel crypto
  235. * driver. Each driver that wants to instantiate iorpc calls in the
  236. * kernel needs to generate a kernel version of the generate rpc code
  237. * and (probably) copy any related gxio source files into the kernel.
  238. * The mPIPE driver provides a good example of this pattern.
  239. */
  240. #ifdef __KERNEL__
  241. #include <linux/stddef.h>
  242. #else
  243. #include <stddef.h>
  244. #endif
  245. #if defined(__HV__)
  246. #include <hv/hypervisor.h>
  247. #elif defined(__KERNEL__)
  248. #include <hv/hypervisor.h>
  249. #include <linux/types.h>
  250. #else
  251. #include <stdint.h>
  252. #endif
  253. /** Code indicating translation services required within the RPC path.
  254. * These indicate whether there is a translatable struct at the start
  255. * of the RPC buffer and what information that struct contains.
  256. */
  257. enum iorpc_format_e
  258. {
  259. /** No translation required, no prefix struct. */
  260. IORPC_FORMAT_NONE,
  261. /** No translation required, no prefix struct, no access to this
  262. * operation from user space. */
  263. IORPC_FORMAT_NONE_NOUSER,
  264. /** Prefix struct contains user VA and size. */
  265. IORPC_FORMAT_USER_MEM,
  266. /** Prefix struct contains CPA, size, and homing bits. */
  267. IORPC_FORMAT_KERNEL_MEM,
  268. /** Prefix struct contains interrupt. */
  269. IORPC_FORMAT_KERNEL_INTERRUPT,
  270. /** Prefix struct contains user-level interrupt. */
  271. IORPC_FORMAT_USER_INTERRUPT,
  272. /** Prefix struct contains pollfd_setup (interrupt information). */
  273. IORPC_FORMAT_KERNEL_POLLFD_SETUP,
  274. /** Prefix struct contains user-level pollfd_setup (file descriptor). */
  275. IORPC_FORMAT_USER_POLLFD_SETUP,
  276. /** Prefix struct contains pollfd (interrupt cookie). */
  277. IORPC_FORMAT_KERNEL_POLLFD,
  278. /** Prefix struct contains user-level pollfd (file descriptor). */
  279. IORPC_FORMAT_USER_POLLFD,
  280. };
  281. /** Generate an opcode given format and code. */
  282. #define IORPC_OPCODE(FORMAT, CODE) (((FORMAT) << 16) | (CODE))
  283. /** The offset passed through the read() and write() system calls
  284. combines an opcode with 32 bits of user-specified offset. */
  285. union iorpc_offset
  286. {
  287. #ifndef __BIG_ENDIAN__
  288. uint64_t offset; /**< All bits. */
  289. struct
  290. {
  291. uint16_t code; /**< RPC code. */
  292. uint16_t format; /**< iorpc_format_e */
  293. uint32_t sub_offset; /**< caller-specified offset. */
  294. };
  295. uint32_t opcode; /**< Opcode combines code & format. */
  296. #else
  297. uint64_t offset; /**< All bits. */
  298. struct
  299. {
  300. uint32_t sub_offset; /**< caller-specified offset. */
  301. uint16_t format; /**< iorpc_format_e */
  302. uint16_t code; /**< RPC code. */
  303. };
  304. struct
  305. {
  306. uint32_t padding;
  307. uint32_t opcode; /**< Opcode combines code & format. */
  308. };
  309. #endif
  310. };
  311. /** Homing and cache hinting bits that can be used by IO devices. */
  312. struct iorpc_mem_attr
  313. {
  314. unsigned int lotar_x:4; /**< lotar X bits (or Gx page_mask). */
  315. unsigned int lotar_y:4; /**< lotar Y bits (or Gx page_offset). */
  316. unsigned int hfh:1; /**< Uses hash-for-home. */
  317. unsigned int nt_hint:1; /**< Non-temporal hint. */
  318. unsigned int io_pin:1; /**< Only fill 'IO' cache ways. */
  319. };
  320. /** Set the nt_hint bit. */
  321. #define IORPC_MEM_BUFFER_FLAG_NT_HINT (1 << 0)
  322. /** Set the IO pin bit. */
  323. #define IORPC_MEM_BUFFER_FLAG_IO_PIN (1 << 1)
  324. /** A structure used to describe memory registration. Different
  325. protection levels describe memory differently, so this union
  326. contains all the different possible descriptions. As a request
  327. moves up the call chain, each layer translates from one
  328. description format to the next. In particular, the Linux iorpc
  329. driver translates user VAs into CPAs and homing parameters. */
  330. union iorpc_mem_buffer
  331. {
  332. struct
  333. {
  334. uint64_t va; /**< User virtual address. */
  335. uint64_t size; /**< Buffer size. */
  336. unsigned int flags; /**< nt_hint, IO pin. */
  337. }
  338. user; /**< Buffer as described by user apps. */
  339. struct
  340. {
  341. unsigned long long cpa; /**< Client physical address. */
  342. #if defined(__KERNEL__) || defined(__HV__)
  343. size_t size; /**< Buffer size. */
  344. HV_PTE pte; /**< PTE describing memory homing. */
  345. #else
  346. uint64_t size;
  347. uint64_t pte;
  348. #endif
  349. unsigned int flags; /**< nt_hint, IO pin. */
  350. }
  351. kernel; /**< Buffer as described by kernel. */
  352. struct
  353. {
  354. unsigned long long pa; /**< Physical address. */
  355. size_t size; /**< Buffer size. */
  356. struct iorpc_mem_attr attr; /**< Homing and locality hint bits. */
  357. }
  358. hv; /**< Buffer parameters for HV driver. */
  359. };
  360. /** A structure used to describe interrupts. The format differs slightly
  361. * for user and kernel interrupts. As with the mem_buffer_t, translation
  362. * between the formats is done at each level. */
  363. union iorpc_interrupt
  364. {
  365. struct
  366. {
  367. int cpu; /**< CPU. */
  368. int event; /**< evt_num */
  369. }
  370. user; /**< Interrupt as described by user applications. */
  371. struct
  372. {
  373. int x; /**< X coord. */
  374. int y; /**< Y coord. */
  375. int ipi; /**< int_num */
  376. int event; /**< evt_num */
  377. }
  378. kernel; /**< Interrupt as described by the kernel. */
  379. };
  380. /** A structure used to describe interrupts used with poll(). The format
  381. * differs significantly for requests from user to kernel, and kernel to
  382. * hypervisor. As with the mem_buffer_t, translation between the formats
  383. * is done at each level. */
  384. union iorpc_pollfd_setup
  385. {
  386. struct
  387. {
  388. int fd; /**< Pollable file descriptor. */
  389. }
  390. user; /**< pollfd_setup as described by user applications. */
  391. struct
  392. {
  393. int x; /**< X coord. */
  394. int y; /**< Y coord. */
  395. int ipi; /**< int_num */
  396. int event; /**< evt_num */
  397. }
  398. kernel; /**< pollfd_setup as described by the kernel. */
  399. };
  400. /** A structure used to describe previously set up interrupts used with
  401. * poll(). The format differs significantly for requests from user to
  402. * kernel, and kernel to hypervisor. As with the mem_buffer_t, translation
  403. * between the formats is done at each level. */
  404. union iorpc_pollfd
  405. {
  406. struct
  407. {
  408. int fd; /**< Pollable file descriptor. */
  409. }
  410. user; /**< pollfd as described by user applications. */
  411. struct
  412. {
  413. int cookie; /**< hv cookie returned by the pollfd_setup operation. */
  414. }
  415. kernel; /**< pollfd as described by the kernel. */
  416. };
  417. /** The various iorpc devices use error codes from -1100 to -1299.
  418. *
  419. * This range is distinct from netio (-700 to -799), the hypervisor
  420. * (-800 to -899), tilepci (-900 to -999), ilib (-1000 to -1099),
  421. * gxcr (-1300 to -1399) and gxpci (-1400 to -1499).
  422. */
  423. enum gxio_err_e {
  424. /** Largest iorpc error number. */
  425. GXIO_ERR_MAX = -1101,
  426. /********************************************************/
  427. /* Generic Error Codes */
  428. /********************************************************/
  429. /** Bad RPC opcode - possible version incompatibility. */
  430. GXIO_ERR_OPCODE = -1101,
  431. /** Invalid parameter. */
  432. GXIO_ERR_INVAL = -1102,
  433. /** Memory buffer did not meet alignment requirements. */
  434. GXIO_ERR_ALIGNMENT = -1103,
  435. /** Memory buffers must be coherent and cacheable. */
  436. GXIO_ERR_COHERENCE = -1104,
  437. /** Resource already initialized. */
  438. GXIO_ERR_ALREADY_INIT = -1105,
  439. /** No service domains available. */
  440. GXIO_ERR_NO_SVC_DOM = -1106,
  441. /** Illegal service domain number. */
  442. GXIO_ERR_INVAL_SVC_DOM = -1107,
  443. /** Illegal MMIO address. */
  444. GXIO_ERR_MMIO_ADDRESS = -1108,
  445. /** Illegal interrupt binding. */
  446. GXIO_ERR_INTERRUPT = -1109,
  447. /** Unreasonable client memory. */
  448. GXIO_ERR_CLIENT_MEMORY = -1110,
  449. /** No more IOTLB entries. */
  450. GXIO_ERR_IOTLB_ENTRY = -1111,
  451. /** Invalid memory size. */
  452. GXIO_ERR_INVAL_MEMORY_SIZE = -1112,
  453. /** Unsupported operation. */
  454. GXIO_ERR_UNSUPPORTED_OP = -1113,
  455. /** Insufficient DMA credits. */
  456. GXIO_ERR_DMA_CREDITS = -1114,
  457. /** Operation timed out. */
  458. GXIO_ERR_TIMEOUT = -1115,
  459. /** No such device or object. */
  460. GXIO_ERR_NO_DEVICE = -1116,
  461. /** Device or resource busy. */
  462. GXIO_ERR_BUSY = -1117,
  463. /** I/O error. */
  464. GXIO_ERR_IO = -1118,
  465. /** Permissions error. */
  466. GXIO_ERR_PERM = -1119,
  467. /********************************************************/
  468. /* Test Device Error Codes */
  469. /********************************************************/
  470. /** Illegal register number. */
  471. GXIO_TEST_ERR_REG_NUMBER = -1120,
  472. /** Illegal buffer slot. */
  473. GXIO_TEST_ERR_BUFFER_SLOT = -1121,
  474. /********************************************************/
  475. /* MPIPE Error Codes */
  476. /********************************************************/
  477. /** Invalid buffer size. */
  478. GXIO_MPIPE_ERR_INVAL_BUFFER_SIZE = -1131,
  479. /** Cannot allocate buffer stack. */
  480. GXIO_MPIPE_ERR_NO_BUFFER_STACK = -1140,
  481. /** Invalid buffer stack number. */
  482. GXIO_MPIPE_ERR_BAD_BUFFER_STACK = -1141,
  483. /** Cannot allocate NotifRing. */
  484. GXIO_MPIPE_ERR_NO_NOTIF_RING = -1142,
  485. /** Invalid NotifRing number. */
  486. GXIO_MPIPE_ERR_BAD_NOTIF_RING = -1143,
  487. /** Cannot allocate NotifGroup. */
  488. GXIO_MPIPE_ERR_NO_NOTIF_GROUP = -1144,
  489. /** Invalid NotifGroup number. */
  490. GXIO_MPIPE_ERR_BAD_NOTIF_GROUP = -1145,
  491. /** Cannot allocate bucket. */
  492. GXIO_MPIPE_ERR_NO_BUCKET = -1146,
  493. /** Invalid bucket number. */
  494. GXIO_MPIPE_ERR_BAD_BUCKET = -1147,
  495. /** Cannot allocate eDMA ring. */
  496. GXIO_MPIPE_ERR_NO_EDMA_RING = -1148,
  497. /** Invalid eDMA ring number. */
  498. GXIO_MPIPE_ERR_BAD_EDMA_RING = -1149,
  499. /** Invalid channel number. */
  500. GXIO_MPIPE_ERR_BAD_CHANNEL = -1150,
  501. /** Bad configuration. */
  502. GXIO_MPIPE_ERR_BAD_CONFIG = -1151,
  503. /** Empty iqueue. */
  504. GXIO_MPIPE_ERR_IQUEUE_EMPTY = -1152,
  505. /** Empty rules. */
  506. GXIO_MPIPE_ERR_RULES_EMPTY = -1160,
  507. /** Full rules. */
  508. GXIO_MPIPE_ERR_RULES_FULL = -1161,
  509. /** Corrupt rules. */
  510. GXIO_MPIPE_ERR_RULES_CORRUPT = -1162,
  511. /** Invalid rules. */
  512. GXIO_MPIPE_ERR_RULES_INVALID = -1163,
  513. /** Classifier is too big. */
  514. GXIO_MPIPE_ERR_CLASSIFIER_TOO_BIG = -1170,
  515. /** Classifier is too complex. */
  516. GXIO_MPIPE_ERR_CLASSIFIER_TOO_COMPLEX = -1171,
  517. /** Classifier has bad header. */
  518. GXIO_MPIPE_ERR_CLASSIFIER_BAD_HEADER = -1172,
  519. /** Classifier has bad contents. */
  520. GXIO_MPIPE_ERR_CLASSIFIER_BAD_CONTENTS = -1173,
  521. /** Classifier encountered invalid symbol. */
  522. GXIO_MPIPE_ERR_CLASSIFIER_INVAL_SYMBOL = -1174,
  523. /** Classifier encountered invalid bounds. */
  524. GXIO_MPIPE_ERR_CLASSIFIER_INVAL_BOUNDS = -1175,
  525. /** Classifier encountered invalid relocation. */
  526. GXIO_MPIPE_ERR_CLASSIFIER_INVAL_RELOCATION = -1176,
  527. /** Classifier encountered undefined symbol. */
  528. GXIO_MPIPE_ERR_CLASSIFIER_UNDEF_SYMBOL = -1177,
  529. /********************************************************/
  530. /* TRIO Error Codes */
  531. /********************************************************/
  532. /** Cannot allocate memory map region. */
  533. GXIO_TRIO_ERR_NO_MEMORY_MAP = -1180,
  534. /** Invalid memory map region number. */
  535. GXIO_TRIO_ERR_BAD_MEMORY_MAP = -1181,
  536. /** Cannot allocate scatter queue. */
  537. GXIO_TRIO_ERR_NO_SCATTER_QUEUE = -1182,
  538. /** Invalid scatter queue number. */
  539. GXIO_TRIO_ERR_BAD_SCATTER_QUEUE = -1183,
  540. /** Cannot allocate push DMA ring. */
  541. GXIO_TRIO_ERR_NO_PUSH_DMA_RING = -1184,
  542. /** Invalid push DMA ring index. */
  543. GXIO_TRIO_ERR_BAD_PUSH_DMA_RING = -1185,
  544. /** Cannot allocate pull DMA ring. */
  545. GXIO_TRIO_ERR_NO_PULL_DMA_RING = -1186,
  546. /** Invalid pull DMA ring index. */
  547. GXIO_TRIO_ERR_BAD_PULL_DMA_RING = -1187,
  548. /** Cannot allocate PIO region. */
  549. GXIO_TRIO_ERR_NO_PIO = -1188,
  550. /** Invalid PIO region index. */
  551. GXIO_TRIO_ERR_BAD_PIO = -1189,
  552. /** Cannot allocate ASID. */
  553. GXIO_TRIO_ERR_NO_ASID = -1190,
  554. /** Invalid ASID. */
  555. GXIO_TRIO_ERR_BAD_ASID = -1191,
  556. /********************************************************/
  557. /* MICA Error Codes */
  558. /********************************************************/
  559. /** No such accelerator type. */
  560. GXIO_MICA_ERR_BAD_ACCEL_TYPE = -1220,
  561. /** Cannot allocate context. */
  562. GXIO_MICA_ERR_NO_CONTEXT = -1221,
  563. /** PKA command queue is full, can't add another command. */
  564. GXIO_MICA_ERR_PKA_CMD_QUEUE_FULL = -1222,
  565. /** PKA result queue is empty, can't get a result from the queue. */
  566. GXIO_MICA_ERR_PKA_RESULT_QUEUE_EMPTY = -1223,
  567. /********************************************************/
  568. /* GPIO Error Codes */
  569. /********************************************************/
  570. /** Pin not available. Either the physical pin does not exist, or
  571. * it is reserved by the hypervisor for system usage. */
  572. GXIO_GPIO_ERR_PIN_UNAVAILABLE = -1240,
  573. /** Pin busy. The pin exists, and is available for use via GXIO, but
  574. * it has been attached by some other process or driver. */
  575. GXIO_GPIO_ERR_PIN_BUSY = -1241,
  576. /** Cannot access unattached pin. One or more of the pins being
  577. * manipulated by this call are not attached to the requesting
  578. * context. */
  579. GXIO_GPIO_ERR_PIN_UNATTACHED = -1242,
  580. /** Invalid I/O mode for pin. The wiring of the pin in the system
  581. * is such that the I/O mode or electrical control parameters
  582. * requested could cause damage. */
  583. GXIO_GPIO_ERR_PIN_INVALID_MODE = -1243,
  584. /** Smallest iorpc error number. */
  585. GXIO_ERR_MIN = -1299
  586. };
  587. #endif /* !_HV_IORPC_H_ */