Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 1 | RapidIO sysfs Files |
| 2 | |
| 3 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 4 | |
Alexandre Bounine | 2aaf308 | 2014-04-07 15:38:56 -0700 | [diff] [blame] | 5 | 1. RapidIO Device Subdirectories |
| 6 | -------------------------------- |
Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 7 | |
| 8 | For each RapidIO device, the RapidIO subsystem creates files in an individual |
| 9 | subdirectory with the following name, /sys/bus/rapidio/devices/<device_name>. |
| 10 | |
| 11 | The format of device_name is "nn:d:iiii", where: |
| 12 | |
| 13 | nn - two-digit hexadecimal ID of RapidIO network where the device resides |
| 14 | d - device typr: 'e' - for endpoint or 's' - for switch |
| 15 | iiii - four-digit device destID for endpoints, or switchID for switches |
| 16 | |
| 17 | For example, below is a list of device directories that represents a typical |
| 18 | RapidIO network with one switch, one host, and two agent endpoints, as it is |
| 19 | seen by the enumerating host (destID = 1): |
| 20 | |
| 21 | /sys/bus/rapidio/devices/00:e:0000 |
| 22 | /sys/bus/rapidio/devices/00:e:0002 |
| 23 | /sys/bus/rapidio/devices/00:s:0001 |
| 24 | |
| 25 | NOTE: An enumerating or discovering endpoint does not create a sysfs entry for |
| 26 | itself, this is why an endpoint with destID=1 is not shown in the list. |
| 27 | |
Alexandre Bounine | 2aaf308 | 2014-04-07 15:38:56 -0700 | [diff] [blame] | 28 | 2. Attributes Common for All RapidIO Devices |
| 29 | -------------------------------------------- |
Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 30 | |
| 31 | Each device subdirectory contains the following informational read-only files: |
| 32 | |
| 33 | did - returns the device identifier |
| 34 | vid - returns the device vendor identifier |
| 35 | device_rev - returns the device revision level |
| 36 | asm_did - returns identifier for the assembly containing the device |
| 37 | asm_rev - returns revision level of the assembly containing the device |
| 38 | asm_vid - returns vendor identifier of the assembly containing the device |
| 39 | destid - returns device destination ID assigned by the enumeration routine |
| 40 | (see 4.1 for switch specific details) |
| 41 | lprev - returns name of previous device (switch) on the path to the device |
| 42 | that that owns this attribute |
Alexandre Bounine | ed5edee | 2013-07-03 15:08:59 -0700 | [diff] [blame] | 43 | modalias - returns the device modalias |
Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 44 | |
| 45 | In addition to the files listed above, each device has a binary attribute file |
| 46 | that allows read/write access to the device configuration registers using |
| 47 | the RapidIO maintenance transactions: |
| 48 | |
| 49 | config - reads from and writes to the device configuration registers. |
| 50 | |
| 51 | This attribute is similar in behavior to the "config" attribute of PCI devices |
| 52 | and provides an access to the RapidIO device registers using standard file read |
| 53 | and write operations. |
| 54 | |
Alexandre Bounine | 2aaf308 | 2014-04-07 15:38:56 -0700 | [diff] [blame] | 55 | 3. RapidIO Endpoint Device Attributes |
| 56 | ------------------------------------- |
Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 57 | |
| 58 | Currently Linux RapidIO subsystem does not create any endpoint specific sysfs |
| 59 | attributes. It is possible that RapidIO master port drivers and endpoint device |
| 60 | drivers will add their device-specific sysfs attributes but such attributes are |
| 61 | outside the scope of this document. |
| 62 | |
Alexandre Bounine | 2aaf308 | 2014-04-07 15:38:56 -0700 | [diff] [blame] | 63 | 4. RapidIO Switch Device Attributes |
| 64 | ----------------------------------- |
Alexandre Bounine | e15b4d6 | 2011-03-23 16:43:00 -0700 | [diff] [blame] | 65 | |
| 66 | RapidIO switches have additional attributes in sysfs. RapidIO subsystem supports |
| 67 | common and device-specific sysfs attributes for switches. Because switches are |
| 68 | integrated into the RapidIO subsystem, it offers a method to create |
| 69 | device-specific sysfs attributes by specifying a callback function that may be |
| 70 | set by the switch initialization routine during enumeration or discovery process. |
| 71 | |
| 72 | 4.1 Common Switch Attributes |
| 73 | |
| 74 | routes - reports switch routing information in "destID port" format. This |
| 75 | attribute reports only valid routing table entries, one line for |
| 76 | each entry. |
| 77 | destid - device destination ID that defines a route to the switch |
| 78 | hopcount - number of hops on the path to the switch |
| 79 | lnext - returns names of devices linked to the switch except one of a device |
| 80 | linked to the ingress port (reported as "lprev"). This is an array |
| 81 | names with number of lines equal to number of ports in switch. If |
| 82 | a switch port has no attached device, returns "null" instead of |
| 83 | a device name. |
| 84 | |
| 85 | 4.2 Device-specific Switch Attributes |
| 86 | |
| 87 | Device-specific switch attributes are listed for each RapidIO switch driver |
| 88 | that exports additional attributes. |
| 89 | |
| 90 | IDT_GEN2: |
| 91 | errlog - reads contents of device error log until it is empty. |
Alexandre Bounine | 5eeb929 | 2013-05-24 15:55:07 -0700 | [diff] [blame] | 92 | |
| 93 | |
| 94 | 5. RapidIO Bus Attributes |
| 95 | ------------------------- |
| 96 | |
| 97 | RapidIO bus subdirectory /sys/bus/rapidio implements the following bus-specific |
| 98 | attribute: |
| 99 | |
| 100 | scan - allows to trigger enumeration discovery process from user space. This |
| 101 | is a write-only attribute. To initiate an enumeration or discovery |
| 102 | process on specific mport device, a user needs to write mport_ID (not |
| 103 | RapidIO destination ID) into this file. The mport_ID is a sequential |
| 104 | number (0 ... RIO_MAX_MPORTS) assigned to the mport device. |
| 105 | For example, for a machine with a single RapidIO controller, mport_ID |
| 106 | for that controller always will be 0. |
| 107 | To initiate RapidIO enumeration/discovery on all available mports |
| 108 | a user must write '-1' (or RIO_MPORT_ANY) into this attribute file. |
Alexandre Bounine | 2aaf308 | 2014-04-07 15:38:56 -0700 | [diff] [blame] | 109 | |
| 110 | |
| 111 | 6. RapidIO Bus Controllers/Ports |
| 112 | -------------------------------- |
| 113 | |
| 114 | On-chip RapidIO controllers and PCIe-to-RapidIO bridges (referenced as |
| 115 | "Master Port" or "mport") are presented in sysfs as the special class of |
| 116 | devices: "rapidio_port". |
| 117 | |
| 118 | The /sys/class/rapidio_port subdirectory contains individual subdirectories |
| 119 | named as "rapidioN" where N = mport ID registered with RapidIO subsystem. |
| 120 | |
| 121 | NOTE: An mport ID is not a RapidIO destination ID assigned to a given local |
| 122 | mport device. |
| 123 | |
| 124 | Each mport device subdirectory in addition to standard entries contains the |
| 125 | following device-specific attributes: |
| 126 | |
| 127 | port_destid - reports RapidIO destination ID assigned to the given RapidIO |
| 128 | mport device. If value 0xFFFFFFFF is returned this means that |
| 129 | no valid destination ID have been assigned to the mport (yet). |
| 130 | Normally, before enumeration/discovery have been executed only |
| 131 | fabric enumerating mports have a valid destination ID assigned |
| 132 | to them using "hdid=..." rapidio module parameter. |
| 133 | sys_size - reports RapidIO common transport system size: |
| 134 | 0 = small (8-bit destination ID, max. 256 devices), |
| 135 | 1 = large (16-bit destination ID, max. 65536 devices). |
| 136 | |
| 137 | After enumeration or discovery was performed for a given mport device, |
| 138 | the corresponding subdirectory will also contain subdirectories for each |
| 139 | child RapidIO device connected to the mport. Naming conventions for RapidIO |
| 140 | devices are described in Section 1 above. |
| 141 | |
| 142 | The example below shows mport device subdirectory with several child RapidIO |
| 143 | devices attached to it. |
| 144 | |
| 145 | [rio@rapidio ~]$ ls /sys/class/rapidio_port/rapidio0/ -l |
| 146 | total 0 |
| 147 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:e:0001 |
| 148 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:e:0004 |
| 149 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:e:0007 |
| 150 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:s:0002 |
| 151 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:s:0003 |
| 152 | drwxr-xr-x 3 root root 0 Feb 11 15:10 00:s:0005 |
| 153 | lrwxrwxrwx 1 root root 0 Feb 11 15:11 device -> ../../../0000:01:00.0 |
| 154 | -r--r--r-- 1 root root 4096 Feb 11 15:11 port_destid |
| 155 | drwxr-xr-x 2 root root 0 Feb 11 15:11 power |
| 156 | lrwxrwxrwx 1 root root 0 Feb 11 15:04 subsystem -> ../../../../../../class/rapidio_port |
| 157 | -r--r--r-- 1 root root 4096 Feb 11 15:11 sys_size |
| 158 | -rw-r--r-- 1 root root 4096 Feb 11 15:04 uevent |