rio_cm.rst 5.8 KB

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