162306a36Sopenharmony_ci========================================================================== 262306a36Sopenharmony_ciRapidIO subsystem Channelized Messaging character device driver (rio_cm.c) 362306a36Sopenharmony_ci========================================================================== 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci1. Overview 762306a36Sopenharmony_ci=========== 862306a36Sopenharmony_ci 962306a36Sopenharmony_ciThis device driver is the result of collaboration within the RapidIO.org 1062306a36Sopenharmony_ciSoftware Task Group (STG) between Texas Instruments, Prodrive Technologies, 1162306a36Sopenharmony_ciNokia Networks, BAE and IDT. Additional input was received from other members 1262306a36Sopenharmony_ciof RapidIO.org. 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ciThe objective was to create a character mode driver interface which exposes 1562306a36Sopenharmony_cimessaging capabilities of RapidIO endpoint devices (mports) directly 1662306a36Sopenharmony_cito applications, in a manner that allows the numerous and varied RapidIO 1762306a36Sopenharmony_ciimplementations to interoperate. 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciThis driver (RIO_CM) provides to user-space applications shared access to 2062306a36Sopenharmony_ciRapidIO mailbox messaging resources. 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciRapidIO specification (Part 2) defines that endpoint devices may have up to four 2362306a36Sopenharmony_cimessaging mailboxes in case of multi-packet message (up to 4KB) and 2462306a36Sopenharmony_ciup to 64 mailboxes if single-packet messages (up to 256 B) are used. In addition 2562306a36Sopenharmony_cito protocol definition limitations, a particular hardware implementation can 2662306a36Sopenharmony_cihave reduced number of messaging mailboxes. RapidIO aware applications must 2762306a36Sopenharmony_citherefore share the messaging resources of a RapidIO endpoint. 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_ciMain purpose of this device driver is to provide RapidIO mailbox messaging 3062306a36Sopenharmony_cicapability to large number of user-space processes by introducing socket-like 3162306a36Sopenharmony_cioperations using a single messaging mailbox. This allows applications to 3262306a36Sopenharmony_ciuse the limited RapidIO messaging hardware resources efficiently. 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ciMost of device driver's operations are supported through 'ioctl' system calls. 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciWhen loaded this device driver creates a single file system node named rio_cm 3762306a36Sopenharmony_ciin /dev directory common for all registered RapidIO mport devices. 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciFollowing ioctl commands are available to user-space applications: 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci- RIO_CM_MPORT_GET_LIST: 4262306a36Sopenharmony_ci Returns to caller list of local mport devices that 4362306a36Sopenharmony_ci support messaging operations (number of entries up to RIO_MAX_MPORTS). 4462306a36Sopenharmony_ci Each list entry is combination of mport's index in the system and RapidIO 4562306a36Sopenharmony_ci destination ID assigned to the port. 4662306a36Sopenharmony_ci- RIO_CM_EP_GET_LIST_SIZE: 4762306a36Sopenharmony_ci Returns number of messaging capable remote endpoints 4862306a36Sopenharmony_ci in a RapidIO network associated with the specified mport device. 4962306a36Sopenharmony_ci- RIO_CM_EP_GET_LIST: 5062306a36Sopenharmony_ci Returns list of RapidIO destination IDs for messaging 5162306a36Sopenharmony_ci capable remote endpoints (peers) available in a RapidIO network associated 5262306a36Sopenharmony_ci with the specified mport device. 5362306a36Sopenharmony_ci- RIO_CM_CHAN_CREATE: 5462306a36Sopenharmony_ci Creates RapidIO message exchange channel data structure 5562306a36Sopenharmony_ci with channel ID assigned automatically or as requested by a caller. 5662306a36Sopenharmony_ci- RIO_CM_CHAN_BIND: 5762306a36Sopenharmony_ci Binds the specified channel data structure to the specified 5862306a36Sopenharmony_ci mport device. 5962306a36Sopenharmony_ci- RIO_CM_CHAN_LISTEN: 6062306a36Sopenharmony_ci Enables listening for connection requests on the specified 6162306a36Sopenharmony_ci channel. 6262306a36Sopenharmony_ci- RIO_CM_CHAN_ACCEPT: 6362306a36Sopenharmony_ci Accepts a connection request from peer on the specified 6462306a36Sopenharmony_ci channel. If wait timeout for this request is specified by a caller it is 6562306a36Sopenharmony_ci a blocking call. If timeout set to 0 this is non-blocking call - ioctl 6662306a36Sopenharmony_ci handler checks for a pending connection request and if one is not available 6762306a36Sopenharmony_ci exits with -EGAIN error status immediately. 6862306a36Sopenharmony_ci- RIO_CM_CHAN_CONNECT: 6962306a36Sopenharmony_ci Sends a connection request to a remote peer/channel. 7062306a36Sopenharmony_ci- RIO_CM_CHAN_SEND: 7162306a36Sopenharmony_ci Sends a data message through the specified channel. 7262306a36Sopenharmony_ci The handler for this request assumes that message buffer specified by 7362306a36Sopenharmony_ci a caller includes the reserved space for a packet header required by 7462306a36Sopenharmony_ci this driver. 7562306a36Sopenharmony_ci- RIO_CM_CHAN_RECEIVE: 7662306a36Sopenharmony_ci Receives a data message through a connected channel. 7762306a36Sopenharmony_ci If the channel does not have an incoming message ready to return this ioctl 7862306a36Sopenharmony_ci handler will wait for new message until timeout specified by a caller 7962306a36Sopenharmony_ci expires. If timeout value is set to 0, ioctl handler uses a default value 8062306a36Sopenharmony_ci defined by MAX_SCHEDULE_TIMEOUT. 8162306a36Sopenharmony_ci- RIO_CM_CHAN_CLOSE: 8262306a36Sopenharmony_ci Closes a specified channel and frees associated buffers. 8362306a36Sopenharmony_ci If the specified channel is in the CONNECTED state, sends close notification 8462306a36Sopenharmony_ci to the remote peer. 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ciThe ioctl command codes and corresponding data structures intended for use by 8762306a36Sopenharmony_ciuser-space applications are defined in 'include/uapi/linux/rio_cm_cdev.h'. 8862306a36Sopenharmony_ci 8962306a36Sopenharmony_ci2. Hardware Compatibility 9062306a36Sopenharmony_ci========================= 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ciThis device driver uses standard interfaces defined by kernel RapidIO subsystem 9362306a36Sopenharmony_ciand therefore it can be used with any mport device driver registered by RapidIO 9462306a36Sopenharmony_cisubsystem with limitations set by available mport HW implementation of messaging 9562306a36Sopenharmony_cimailboxes. 9662306a36Sopenharmony_ci 9762306a36Sopenharmony_ci3. Module parameters 9862306a36Sopenharmony_ci==================== 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci- 'dbg_level' 10162306a36Sopenharmony_ci - This parameter allows to control amount of debug information 10262306a36Sopenharmony_ci generated by this device driver. This parameter is formed by set of 10362306a36Sopenharmony_ci bit masks that correspond to the specific functional block. 10462306a36Sopenharmony_ci For mask definitions see 'drivers/rapidio/devices/rio_cm.c' 10562306a36Sopenharmony_ci This parameter can be changed dynamically. 10662306a36Sopenharmony_ci Use CONFIG_RAPIDIO_DEBUG=y to enable debug output at the top level. 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci- 'cmbox' 10962306a36Sopenharmony_ci - Number of RapidIO mailbox to use (default value is 1). 11062306a36Sopenharmony_ci This parameter allows to set messaging mailbox number that will be used 11162306a36Sopenharmony_ci within entire RapidIO network. It can be used when default mailbox is 11262306a36Sopenharmony_ci used by other device drivers or is not supported by some nodes in the 11362306a36Sopenharmony_ci RapidIO network. 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci- 'chstart' 11662306a36Sopenharmony_ci - Start channel number for dynamic assignment. Default value - 256. 11762306a36Sopenharmony_ci Allows to exclude channel numbers below this parameter from dynamic 11862306a36Sopenharmony_ci allocation to avoid conflicts with software components that use 11962306a36Sopenharmony_ci reserved predefined channel numbers. 12062306a36Sopenharmony_ci 12162306a36Sopenharmony_ci4. Known problems 12262306a36Sopenharmony_ci================= 12362306a36Sopenharmony_ci 12462306a36Sopenharmony_ci None. 12562306a36Sopenharmony_ci 12662306a36Sopenharmony_ci5. User-space Applications and API Library 12762306a36Sopenharmony_ci========================================== 12862306a36Sopenharmony_ci 12962306a36Sopenharmony_ciMessaging API library and applications that use this device driver are available 13062306a36Sopenharmony_cifrom RapidIO.org. 13162306a36Sopenharmony_ci 13262306a36Sopenharmony_ci6. TODO List 13362306a36Sopenharmony_ci============ 13462306a36Sopenharmony_ci 13562306a36Sopenharmony_ci- Add support for system notification messages (reserved channel 0). 136