0001 ==========================================================================
0002 RapidIO subsystem Channelized Messaging character device driver (rio_cm.c)
0003 ==========================================================================
0004
0005
0006 1. Overview
0007 ===========
0008
0009 This device driver is the result of collaboration within the RapidIO.org
0010 Software Task Group (STG) between Texas Instruments, Prodrive Technologies,
0011 Nokia Networks, BAE and IDT. Additional input was received from other members
0012 of RapidIO.org.
0013
0014 The objective was to create a character mode driver interface which exposes
0015 messaging capabilities of RapidIO endpoint devices (mports) directly
0016 to applications, in a manner that allows the numerous and varied RapidIO
0017 implementations to interoperate.
0018
0019 This driver (RIO_CM) provides to user-space applications shared access to
0020 RapidIO mailbox messaging resources.
0021
0022 RapidIO specification (Part 2) defines that endpoint devices may have up to four
0023 messaging mailboxes in case of multi-packet message (up to 4KB) and
0024 up to 64 mailboxes if single-packet messages (up to 256 B) are used. In addition
0025 to protocol definition limitations, a particular hardware implementation can
0026 have reduced number of messaging mailboxes. RapidIO aware applications must
0027 therefore share the messaging resources of a RapidIO endpoint.
0028
0029 Main purpose of this device driver is to provide RapidIO mailbox messaging
0030 capability to large number of user-space processes by introducing socket-like
0031 operations using a single messaging mailbox. This allows applications to
0032 use the limited RapidIO messaging hardware resources efficiently.
0033
0034 Most of device driver's operations are supported through 'ioctl' system calls.
0035
0036 When loaded this device driver creates a single file system node named rio_cm
0037 in /dev directory common for all registered RapidIO mport devices.
0038
0039 Following ioctl commands are available to user-space applications:
0040
0041 - RIO_CM_MPORT_GET_LIST:
0042 Returns to caller list of local mport devices that
0043 support messaging operations (number of entries up to RIO_MAX_MPORTS).
0044 Each list entry is combination of mport's index in the system and RapidIO
0045 destination ID assigned to the port.
0046 - RIO_CM_EP_GET_LIST_SIZE:
0047 Returns number of messaging capable remote endpoints
0048 in a RapidIO network associated with the specified mport device.
0049 - RIO_CM_EP_GET_LIST:
0050 Returns list of RapidIO destination IDs for messaging
0051 capable remote endpoints (peers) available in a RapidIO network associated
0052 with the specified mport device.
0053 - RIO_CM_CHAN_CREATE:
0054 Creates RapidIO message exchange channel data structure
0055 with channel ID assigned automatically or as requested by a caller.
0056 - RIO_CM_CHAN_BIND:
0057 Binds the specified channel data structure to the specified
0058 mport device.
0059 - RIO_CM_CHAN_LISTEN:
0060 Enables listening for connection requests on the specified
0061 channel.
0062 - RIO_CM_CHAN_ACCEPT:
0063 Accepts a connection request from peer on the specified
0064 channel. If wait timeout for this request is specified by a caller it is
0065 a blocking call. If timeout set to 0 this is non-blocking call - ioctl
0066 handler checks for a pending connection request and if one is not available
0067 exits with -EGAIN error status immediately.
0068 - RIO_CM_CHAN_CONNECT:
0069 Sends a connection request to a remote peer/channel.
0070 - RIO_CM_CHAN_SEND:
0071 Sends a data message through the specified channel.
0072 The handler for this request assumes that message buffer specified by
0073 a caller includes the reserved space for a packet header required by
0074 this driver.
0075 - RIO_CM_CHAN_RECEIVE:
0076 Receives a data message through a connected channel.
0077 If the channel does not have an incoming message ready to return this ioctl
0078 handler will wait for new message until timeout specified by a caller
0079 expires. If timeout value is set to 0, ioctl handler uses a default value
0080 defined by MAX_SCHEDULE_TIMEOUT.
0081 - RIO_CM_CHAN_CLOSE:
0082 Closes a specified channel and frees associated buffers.
0083 If the specified channel is in the CONNECTED state, sends close notification
0084 to the remote peer.
0085
0086 The ioctl command codes and corresponding data structures intended for use by
0087 user-space applications are defined in 'include/uapi/linux/rio_cm_cdev.h'.
0088
0089 2. Hardware Compatibility
0090 =========================
0091
0092 This device driver uses standard interfaces defined by kernel RapidIO subsystem
0093 and therefore it can be used with any mport device driver registered by RapidIO
0094 subsystem with limitations set by available mport HW implementation of messaging
0095 mailboxes.
0096
0097 3. Module parameters
0098 ====================
0099
0100 - 'dbg_level'
0101 - This parameter allows to control amount of debug information
0102 generated by this device driver. This parameter is formed by set of
0103 bit masks that correspond to the specific functional block.
0104 For mask definitions see 'drivers/rapidio/devices/rio_cm.c'
0105 This parameter can be changed dynamically.
0106 Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level.
0107
0108 - 'cmbox'
0109 - Number of RapidIO mailbox to use (default value is 1).
0110 This parameter allows to set messaging mailbox number that will be used
0111 within entire RapidIO network. It can be used when default mailbox is
0112 used by other device drivers or is not supported by some nodes in the
0113 RapidIO network.
0114
0115 - 'chstart'
0116 - Start channel number for dynamic assignment. Default value - 256.
0117 Allows to exclude channel numbers below this parameter from dynamic
0118 allocation to avoid conflicts with software components that use
0119 reserved predefined channel numbers.
0120
0121 4. Known problems
0122 =================
0123
0124 None.
0125
0126 5. User-space Applications and API Library
0127 ==========================================
0128
0129 Messaging API library and applications that use this device driver are available
0130 from RapidIO.org.
0131
0132 6. TODO List
0133 ============
0134
0135 - Add support for system notification messages (reserved channel 0).