rio_cm.txt 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. RapidIO subsystem Channelized Messaging character device driver (rio_cm.c)
  2. ==========================================================================
  3. Version History:
  4. ----------------
  5. 1.0.0 - Initial driver release.
  6. ==========================================================================
  7. I. Overview
  8. This device driver is the result of collaboration within the RapidIO.org
  9. Software Task Group (STG) between Texas Instruments, Prodrive Technologies,
  10. Nokia Networks, BAE and IDT. Additional input was received from other members
  11. of RapidIO.org.
  12. The objective was to create a character mode driver interface which exposes
  13. messaging capabilities of RapidIO endpoint devices (mports) directly
  14. to applications, in a manner that allows the numerous and varied RapidIO
  15. implementations to interoperate.
  16. This driver (RIO_CM) provides to user-space applications shared access to
  17. RapidIO mailbox messaging resources.
  18. RapidIO specification (Part 2) defines that endpoint devices may have up to four
  19. messaging mailboxes in case of multi-packet message (up to 4KB) and
  20. up to 64 mailboxes if single-packet messages (up to 256 B) are used. In addition
  21. to protocol definition limitations, a particular hardware implementation can
  22. have reduced number of messaging mailboxes. RapidIO aware applications must
  23. therefore share the messaging resources of a RapidIO endpoint.
  24. Main purpose of this device driver is to provide RapidIO mailbox messaging
  25. capability to large number of user-space processes by introducing socket-like
  26. operations using a single messaging mailbox. This allows applications to
  27. use the limited RapidIO messaging hardware resources efficiently.
  28. Most of device driver's operations are supported through 'ioctl' system calls.
  29. When loaded this device driver creates a single file system node named rio_cm
  30. in /dev directory common for all registered RapidIO mport devices.
  31. Following ioctl commands are available to user-space applications:
  32. - RIO_CM_MPORT_GET_LIST : Returns to caller list of local mport devices that
  33. support messaging operations (number of entries up to RIO_MAX_MPORTS).
  34. Each list entry is combination of mport's index in the system and RapidIO
  35. destination ID assigned to the port.
  36. - RIO_CM_EP_GET_LIST_SIZE : Returns number of messaging capable remote endpoints
  37. in a RapidIO network associated with the specified mport device.
  38. - RIO_CM_EP_GET_LIST : Returns list of RapidIO destination IDs for messaging
  39. capable remote endpoints (peers) available in a RapidIO network associated
  40. with the specified mport device.
  41. - RIO_CM_CHAN_CREATE : Creates RapidIO message exchange channel data structure
  42. with channel ID assigned automatically or as requested by a caller.
  43. - RIO_CM_CHAN_BIND : Binds the specified channel data structure to the specified
  44. mport device.
  45. - RIO_CM_CHAN_LISTEN : Enables listening for connection requests on the specified
  46. channel.
  47. - RIO_CM_CHAN_ACCEPT : Accepts a connection request from peer on the specified
  48. channel. If wait timeout for this request is specified by a caller it is
  49. a blocking call. If timeout set to 0 this is non-blocking call - ioctl
  50. handler checks for a pending connection request and if one is not available
  51. exits with -EGAIN error status immediately.
  52. - RIO_CM_CHAN_CONNECT : Sends a connection request to a remote peer/channel.
  53. - RIO_CM_CHAN_SEND : Sends a data message through the specified channel.
  54. The handler for this request assumes that message buffer specified by
  55. a caller includes the reserved space for a packet header required by
  56. this driver.
  57. - RIO_CM_CHAN_RECEIVE : Receives a data message through a connected channel.
  58. If the channel does not have an incoming message ready to return this ioctl
  59. handler will wait for new message until timeout specified by a caller
  60. expires. If timeout value is set to 0, ioctl handler uses a default value
  61. defined by MAX_SCHEDULE_TIMEOUT.
  62. - RIO_CM_CHAN_CLOSE : Closes a specified channel and frees associated buffers.
  63. If the specified channel is in the CONNECTED state, sends close notification
  64. to the remote peer.
  65. The ioctl command codes and corresponding data structures intended for use by
  66. user-space applications are defined in 'include/uapi/linux/rio_cm_cdev.h'.
  67. II. Hardware Compatibility
  68. This device driver uses standard interfaces defined by kernel RapidIO subsystem
  69. and therefore it can be used with any mport device driver registered by RapidIO
  70. subsystem with limitations set by available mport HW implementation of messaging
  71. mailboxes.
  72. III. Module parameters
  73. - 'dbg_level' - This parameter allows to control amount of debug information
  74. generated by this device driver. This parameter is formed by set of
  75. bit masks that correspond to the specific functional block.
  76. For mask definitions see 'drivers/rapidio/devices/rio_cm.c'
  77. This parameter can be changed dynamically.
  78. Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
  79. - 'cmbox' - Number of RapidIO mailbox to use (default value is 1).
  80. This parameter allows to set messaging mailbox number that will be used
  81. within entire RapidIO network. It can be used when default mailbox is
  82. used by other device drivers or is not supported by some nodes in the
  83. RapidIO network.
  84. - 'chstart' - Start channel number for dynamic assignment. Default value - 256.
  85. Allows to exclude channel numbers below this parameter from dynamic
  86. allocation to avoid conflicts with software components that use
  87. reserved predefined channel numbers.
  88. IV. Known problems
  89. None.
  90. V. User-space Applications and API Library
  91. Messaging API library and applications that use this device driver are available
  92. from RapidIO.org.
  93. VI. TODO List
  94. - Add support for system notification messages (reserved channel 0).