summaryrefslogtreecommitdiffstats
path: root/Documentation/rapidio/sysfs.txt
blob: 47ce9a5336e1b05c91944942095d42b094744087 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
                         RapidIO sysfs Files

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

1. RapidIO Device Subdirectories
--------------------------------

For each RapidIO device, the RapidIO subsystem creates files in an individual
subdirectory with the following name, /sys/bus/rapidio/devices/<device_name>.

The format of device_name is "nn:d:iiii", where:

nn - two-digit hexadecimal ID of RapidIO network where the device resides
d  - device typr: 'e' - for endpoint or 's' - for switch
iiii - four-digit device destID for endpoints, or switchID for switches

For example, below is a list of device directories that represents a typical
RapidIO network with one switch, one host, and two agent endpoints, as it is
seen by the enumerating host (destID = 1):

/sys/bus/rapidio/devices/00:e:0000
/sys/bus/rapidio/devices/00:e:0002
/sys/bus/rapidio/devices/00:s:0001

NOTE: An enumerating or discovering endpoint does not create a sysfs entry for
itself, this is why an endpoint with destID=1 is not shown in the list.

2. Attributes Common for All RapidIO Devices
--------------------------------------------

Each device subdirectory contains the following informational read-only files:

       did - returns the device identifier
       vid - returns the device vendor identifier
device_rev - returns the device revision level
   asm_did - returns identifier for the assembly containing the device
   asm_rev - returns revision level of the assembly containing the device
   asm_vid - returns vendor identifier of the assembly containing the device
   destid  - returns device destination ID assigned by the enumeration routine
             (see 4.1 for switch specific details)
   lprev   - returns name of previous device (switch) on the path to the device
             that that owns this attribute
  modalias - returns the device modalias

In addition to the files listed above, each device has a binary attribute file
that allows read/write access to the device configuration registers using
the RapidIO maintenance transactions:

 config - reads from and writes to the device configuration registers.

This attribute is similar in behavior to the "config" attribute of PCI devices
and provides an access to the RapidIO device registers using standard file read
and write operations.

3. RapidIO Endpoint Device Attributes
-------------------------------------

Currently Linux RapidIO subsystem does not create any endpoint specific sysfs
attributes. It is possible that RapidIO master port drivers and endpoint device
drivers will add their device-specific sysfs attributes but such attributes are
outside the scope of this document.

4. RapidIO Switch Device Attributes
-----------------------------------

RapidIO switches have additional attributes in sysfs. RapidIO subsystem supports
common and device-specific sysfs attributes for switches. Because switches are
integrated into the RapidIO subsystem, it offers a method to create
device-specific sysfs attributes by specifying a callback function that may be
set by the switch initialization routine during enumeration or discovery process.

4.1 Common Switch Attributes

   routes - reports switch routing information in "destID port" format. This
            attribute reports only valid routing table entries, one line for
            each entry.
   destid - device destination ID that defines a route to the switch
 hopcount - number of hops on the path to the switch
    lnext - returns names of devices linked to the switch except one of a device
            linked to the ingress port (reported as "lprev"). This is an array
            names with number of lines equal to number of ports in switch. If
            a switch port has no attached device, returns "null" instead of
            a device name.

4.2 Device-specific Switch Attributes

Device-specific switch attributes are listed for each RapidIO switch driver
that exports additional attributes.

IDT_GEN2:
 errlog - reads contents of device error log until it is empty.


5. RapidIO Bus Attributes
-------------------------

RapidIO bus subdirectory /sys/bus/rapidio implements the following bus-specific
attribute:

  scan - allows to trigger enumeration discovery process from user space. This
	 is a write-only attribute. To initiate an enumeration or discovery
	 process on specific mport device, a user needs to write mport_ID (not
	 RapidIO destination ID) into this file. The mport_ID is a sequential
	 number (0 ... RIO_MAX_MPORTS) assigned to the mport device.
	 For example, for a machine with a single RapidIO controller, mport_ID
	 for that controller always will be 0.
	 To initiate RapidIO enumeration/discovery on all available mports
	 a user must write '-1' (or RIO_MPORT_ANY) into this attribute file.


6. RapidIO Bus Controllers/Ports
--------------------------------

On-chip RapidIO controllers and PCIe-to-RapidIO bridges (referenced as
"Master Port" or "mport") are presented in sysfs as the special class of
devices: "rapidio_port".

The /sys/class/rapidio_port subdirectory contains individual subdirectories
named as "rapidioN" where N = mport ID registered with RapidIO subsystem.

NOTE: An mport ID is not a RapidIO destination ID assigned to a given local
mport device.

Each mport device subdirectory in addition to standard entries contains the
following device-specific attributes:

   port_destid - reports RapidIO destination ID assigned to the given RapidIO
                 mport device. If value 0xFFFFFFFF is returned this means that
                 no valid destination ID have been assigned to the mport (yet).
                 Normally, before enumeration/discovery have been executed only
                 fabric enumerating mports have a valid destination ID assigned
                 to them using "hdid=..." rapidio module parameter.
      sys_size - reports RapidIO common transport system size:
                   0 = small (8-bit destination ID, max. 256 devices),
                   1 = large (16-bit destination ID, max. 65536 devices).

After enumeration or discovery was performed for a given mport device,
the corresponding subdirectory will also contain subdirectories for each
child RapidIO device connected to the mport. Naming conventions for RapidIO
devices are described in Section 1 above.

The example below shows mport device subdirectory with several child RapidIO
devices attached to it.

[rio@rapidio ~]$ ls /sys/class/rapidio_port/rapidio0/ -l
total 0
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0001
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0004
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:e:0007
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0002
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0003
drwxr-xr-x 3 root root    0 Feb 11 15:10 00:s:0005
lrwxrwxrwx 1 root root    0 Feb 11 15:11 device -> ../../../0000:01:00.0
-r--r--r-- 1 root root 4096 Feb 11 15:11 port_destid
drwxr-xr-x 2 root root    0 Feb 11 15:11 power
lrwxrwxrwx 1 root root    0 Feb 11 15:04 subsystem -> ../../../../../../class/rapidio_port
-r--r--r-- 1 root root 4096 Feb 11 15:11 sys_size
-rw-r--r-- 1 root root 4096 Feb 11 15:04 uevent
OpenPOWER on IntegriCloud