Source
16
16
The switchtec kernel module implements this functionality.
17
17
18
18
19
19
Interface
20
20
=========
21
21
22
22
The primary means of communicating with the Switchtec management firmware is
23
23
through the Memory-mapped Remote Procedure Call (MRPC) interface.
24
24
Commands are submitted to the interface with a 4-byte command
25
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
26
+
respond with a 4-byte return code and up to 1KB of command-specific
27
27
data. The interface only processes a single command at a time.
28
28
29
29
30
30
Userspace Interface
31
31
===================
32
32
33
33
The MRPC interface will be exposed to userspace through a simple char
34
34
device: /dev/switchtec#, one for each management endpoint in the system.
35
35
36
36
The char device has the following semantics:
37
37
38
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
39
+
The first 4 bytes will be interpreted as the Command ID and the
40
+
remainder will be used as the input data. A write will send the
41
41
command to the firmware to begin processing.
42
42
43
43
* Each write must be followed by exactly one read. Any double write will
44
44
produce an error and any read that doesn't follow a write will
45
45
produce an error.
46
46
47
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.
48
+
the 4-byte Command Return Value plus up to 1024 bytes of output
49
+
data. (The length will be specified by the size parameter of the read
50
+
call -- reading less than 4 bytes will produce an error.)
51
51
52
52
* The poll call will also be supported for userspace applications that
53
53
need to do other things while waiting for the command to complete.
54
54
55
55
The following IOCTLs are also supported by the device:
56
56
57
57
* SWITCHTEC_IOCTL_FLASH_INFO - Retrieve firmware length and number
58
58
of partitions in the device.
59
59
60
60
* SWITCHTEC_IOCTL_FLASH_PART_INFO - Retrieve address and lengeth for
76
76
77
77
* SWITCHTEC_IOCTL_PFF_TO_PORT and SWITCHTEC_IOCTL_PORT_TO_PFF convert
78
78
between PCI Function Framework number (used by the event system)
79
79
and Switchtec Logic Port ID and Partition number (which is more
80
80
user friendly).
81
81
82
82
83
83
Non-Transparent Bridge (NTB) Driver
84
84
===================================
85
85
86
-
An NTB driver is provided for the switchtec hardware in switchtec_ntb.
87
-
Currently, it only supports switches configured with exactly 2
88
-
partitions. It also requires the following configuration settings:
86
+
An NTB hardware driver is provided for the Switchtec hardware in
87
+
ntb_hw_switchtec. Currently, it only supports switches configured with
88
+
exactly 2 NT partitions and zero or more non-NT partitions. It also requires
89
+
the following configuration settings:
89
90
90
-
* Both partitions must be able to access each other's GAS spaces.
91
+
* Both NT partitions must be able to access each other's GAS spaces.
91
92
Thus, the bits in the GAS Access Vector under Management Settings
92
93
must be set to support this.
94
+
* Kernel configuration MUST include support for NTB (CONFIG_NTB needs
95
+
to be set)
96
+
97
+
NT EP BAR 2 will be dynamically configured as a Direct Window, and
98
+
the configuration file does not need to configure it explicitly.
99
+
100
+
Please refer to Documentation/ntb.txt in Linux source tree for an overall
101
+
understanding of the Linux NTB stack. ntb_hw_switchtec works as an NTB
102
+
Hardware Driver in this stack.