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