diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2017-03-02 18:24:32 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-04-12 13:23:37 -0400 |
commit | 44fc691b4fac3aff3e99b42cad3a994f5a6621ac (patch) | |
tree | 01cbe0a250b51a82170563fd8e6c39166930e838 | |
parent | 080b47def5e5e28b2509c5bb92160d1df730f27b (diff) |
switchtec: Add user interface documentation
Add standard documentation for the sysfs switchtec attributes and a RST
formatted text file which documents the char device interface. Jonathan
Corbet has indicated he will move this to a new user-space developer
documentation book once it's created.
Tested-by: Krishna Dhulipala <krishnad@fb.com>
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Stephen Bates <stephen.bates@microsemi.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Wei Zhang <wzhang@fb.com>
Reviewed-by: Jens Axboe <axboe@fb.com>
-rw-r--r-- | Documentation/switchtec.txt | 53 | ||||
-rw-r--r-- | MAINTAINERS | 1 |
2 files changed, 54 insertions, 0 deletions
diff --git a/Documentation/switchtec.txt b/Documentation/switchtec.txt new file mode 100644 index 000000000000..4bced4c78446 --- /dev/null +++ b/Documentation/switchtec.txt | |||
@@ -0,0 +1,53 @@ | |||
1 | ======================== | ||
2 | Linux Switchtec Support | ||
3 | ======================== | ||
4 | |||
5 | Microsemi's "Switchtec" line of PCI switch devices is already | ||
6 | supported by the kernel with standard PCI switch drivers. However, the | ||
7 | Switchtec device advertises a special management endpoint which | ||
8 | enables some additional functionality. This includes: | ||
9 | |||
10 | * Packet and Byte Counters | ||
11 | * Firmware Upgrades | ||
12 | * Event and Error logs | ||
13 | * Querying port link status | ||
14 | * Custom user firmware commands | ||
15 | |||
16 | The switchtec kernel module implements this functionality. | ||
17 | |||
18 | |||
19 | Interface | ||
20 | ========= | ||
21 | |||
22 | The primary means of communicating with the Switchtec management firmware is | ||
23 | through the Memory-mapped Remote Procedure Call (MRPC) interface. | ||
24 | Commands are submitted to the interface with a 4-byte command | ||
25 | identifier and up to 1KB of command specific data. The firmware will | ||
26 | respond with a 4 bytes return code and up to 1KB of command specific | ||
27 | data. The interface only processes a single command at a time. | ||
28 | |||
29 | |||
30 | Userspace Interface | ||
31 | =================== | ||
32 | |||
33 | The MRPC interface will be exposed to userspace through a simple char | ||
34 | device: /dev/switchtec#, one for each management endpoint in the system. | ||
35 | |||
36 | The char device has the following semantics: | ||
37 | |||
38 | * A write must consist of at least 4 bytes and no more than 1028 bytes. | ||
39 | The first four bytes will be interpreted as the command to run and | ||
40 | the remainder will be used as the input data. A write will send the | ||
41 | command to the firmware to begin processing. | ||
42 | |||
43 | * Each write must be followed by exactly one read. Any double write will | ||
44 | produce an error and any read that doesn't follow a write will | ||
45 | produce an error. | ||
46 | |||
47 | * A read will block until the firmware completes the command and return | ||
48 | the four bytes of status plus up to 1024 bytes of output data. (The | ||
49 | length will be specified by the size parameter of the read call -- | ||
50 | reading less than 4 bytes will produce an error. | ||
51 | |||
52 | * The poll call will also be supported for userspace applications that | ||
53 | need to do other things while waiting for the command to complete. | ||
diff --git a/MAINTAINERS b/MAINTAINERS index 16bd75d30ac1..5bc3b7c7e0d9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -9661,6 +9661,7 @@ M: Stephen Bates <stephen.bates@microsemi.com> | |||
9661 | M: Logan Gunthorpe <logang@deltatee.com> | 9661 | M: Logan Gunthorpe <logang@deltatee.com> |
9662 | L: linux-pci@vger.kernel.org | 9662 | L: linux-pci@vger.kernel.org |
9663 | S: Maintained | 9663 | S: Maintained |
9664 | F: Documentation/switchtec.txt | ||
9664 | F: drivers/pci/switch/switchtec* | 9665 | F: drivers/pci/switch/switchtec* |
9665 | 9666 | ||
9666 | PCI DRIVER FOR NVIDIA TEGRA | 9667 | PCI DRIVER FOR NVIDIA TEGRA |