Blame doc/src/fpga_tools/hssi_config/readme.md

Packit 534379
# hssi_config #
Packit 534379
Packit 534379
## Synopsis ##
Packit 534379
```hssi_config``` reads or writes HSSI registers on either on an Intel® FPGA using the 
Packit 534379
FPGA Interface Manager (FIM) or on an HSSI retimer card attached to the board.
Packit 534379
```hssi_config``` is only available for the Integrated FPGA Platform. You cannot run it 
Packit 534379
on the PCIe accelerator card (PAC).
Packit 534379
Packit 534379
## Usage ##
Packit 534379
`hssi_config [--resource|-r <sysfs resource>] [--socket-id|s 0|1] command [command options]`
Packit 534379
Packit 534379
Where command is one of the following:
Packit 534379
Packit 534379
```sh
Packit 534379
    dump [outfile.csv] [--input-file inputfile.csv]
Packit 534379
    iread instance (0,1) device-addr byte-address byte-count
Packit 534379
    iwrite instance (0,1) device-addr byte-address byte1 [byte2 [byte3...]]
Packit 534379
    load [inputfile.csv] [--c-header]
Packit 534379
    read lane(0-15) reg-address
Packit 534379
    rread device(0x30, 0x32, 0x34, 0x36) channel(0-3) address
Packit 534379
    rwrite device(0x30, 0x32, 0x34, 0x36) channel(0-3) address value
Packit 534379
    test (rd|rw) inputfile.csv [--acktimes] [--repeat N]
Packit 534379
    write lane(0-15) reg-address value
Packit 534379
```
Packit 534379
Packit 534379
The first argument is the command and any additional arguments are command arguments.
Packit 534379
The following options and commands are available:
Packit 534379
Packit 534379
### Options ###
Packit 534379
Packit 534379
`[--resource|-r <sysfs resource path>`
Packit 534379
Packit 534379
The resource path in the sysfs pseudo-filesystem.
Packit 534379
Example:
Packit 534379
    `/sys/devices/pci0000\:5e/0000\:5e\:00.0/resource0`
Packit 534379
Packit 534379
`[--socket-id 0|1]`
Packit 534379
Packit 534379
The socket id of the target FPGA.
Packit 534379
Required on two-socket systems to differentiate between the two possible target FPGAs.
Packit 534379
Packit 534379
### Commands ###
Packit 534379
`dump [outfile.csv] [--input-file inputfile.csv]`
Packit 534379
Packit 534379
Dump registers to stdout or to a file, if provided. ```hssi_config``` has a built-in set of registers to
Packit 534379
dump. The first argument is the path to a file to write. The command dumps to stdout if you do not 
Packit 534379
specify a file name. Use the --input-file option to specify a different set of registers. 
Packit 534379
    
Packit 534379
`load [inputfile.csv] [--c-header]`
Packit 534379
Packit 534379
Load a set of register values from either stdin or an input file, if provided. The first argument 
Packit 534379
is the path to a file containing the registers to load. Loads from stdin if omitted.  
Packit 534379
    
Packit 534379
Use --c-header to generate a C header file with an array of 64-bit numbers to write to the 
Packit 534379
```HSSI_CTRL``` register. This header file can substitute for the input file. 
Packit 534379
NOTE: You must perform the acknowledge routine after each write.
Packit 534379
Packit 534379
`read lane(0-15) reg-address`
Packit 534379
Packit 534379
Read from a single XCVR (transceiver) register.
Packit 534379
The first command argument is the XCVR lane. Use -1 to specify a read from all lanes.
Packit 534379
The second argument is the XCVR address (offset).
Packit 534379
Packit 534379
`write lane(0-15) reg-address value`
Packit 534379
Packit 534379
Write to a single XCVR register.
Packit 534379
The first argument is the XCVR lane.
Packit 534379
The second argument is the XCVR address(offset).
Packit 534379
The third argument is the value to write to the register.
Packit 534379
Packit 534379
`rread device(0x30, 0x32, 0x34, 0x36) channel(0-3) address`
Packit 534379
Packit 534379
Read from a single retimer register.
Packit 534379
The first argument is the I2C device address.
Packit 534379
The second argument is the channel.
Packit 534379
The third argument is the register address (or I2C byte address).
Packit 534379
Packit 534379
`rwrite device(0x30, 0x32, 0x34, 0x36) channel(0-3) address value`
Packit 534379
Packit 534379
Write to a single retimer register.
Packit 534379
The first argument is the I2C device address.
Packit 534379
The second argument is the channel.
Packit 534379
The third argument is the register address (or I2C byte address).
Packit 534379
The fourth argument is the value to write.
Packit 534379
Packit 534379
`iread instance (0,1) device-addr byte-address byte-count`
Packit 534379
Packit 534379
Read from a device on the I2C bus.
Packit 534379
The first argument is the I2C controller instance (0 or 1).
Packit 534379
The second argument is the device address to read from.
Packit 534379
The third argument is the byte address of the register to read from the device.
Packit 534379
The fourth argument is the number of bytes to read.
Packit 534379
Packit 534379
`iwrite instance (0,1) device-addr byte-address byte1 [byte2 [byte3...]]`
Packit 534379
Packit 534379
Write to a device on the I2C bus.
Packit 534379
The first argument is the I2C controller instance (0 or 1).
Packit 534379
The second argument is the device address to read from.
Packit 534379
The third argument is the byte address of the register to read from the device.
Packit 534379
All subsequent arguments are the bytes to write to the device.
Packit 534379
Packit 534379
`test (rd|rw) inputfile.csv [--acktimes]`
Packit 534379
Packit 534379
Perform built-in test for reading or writing XCVR registers.
Packit 534379
The first argument is the path to a file containing the registers to test.
Packit 534379
Packit 534379
## Overview ##
Packit 534379
Packit 534379
The ```hssi_config``` utility reads or writes hssi equalization parameters stored in either
Packit 534379
the transceiver (XCVR) registers or the registers of the retimer on the I2C bus. To access registers, 
Packit 534379
the hssi controller writes to the ```HSSI_CTRL``` register and reads from the ```HSSI_STAT```
Packit 534379
register in the FPGA Management Engine (FME). These two registers implement the HSSI AUX bus
Packit 534379
mailbox protocol to access devices on other buses. Because ```hssi_config``` maps the FME MMIO
Packit 534379
space directly, the FPGA driver is not required.
Packit 534379
Packit 534379
## Locating the FME Device ##
Packit 534379
Packit 534379
The FME reads and writes the ```HSSI_CTRL``` and ```HSSI_STAT``` registers on the NIOS device.
Packit 534379
The FME maps the MMIO address space of the FME identified by its resource in the sysfs psuedo-filesystem
Packit 534379
in Linux operating systems. To identify resource paths, use the ```lspci``` utility to query for Intel
Packit 534379
devices with device id of bcc0.
Packit 534379
Packit 534379
Example:
Packit 534379
Packit 534379
`lspci -d 8086:bcc0`
Packit 534379
Packit 534379
This command should print out at least one line like the following example:
Packit 534379
Packit 534379
`5e:00.0 Processing accelerators: Intel Corporation Device bcc0`
Packit 534379
Packit 534379
Use the first three numbers (bus:device.function) to locate the device resource
Packit 534379
in the sysfs filesystem:
Packit 534379
Packit 534379
`/sys/devices/pci0000\:<bus>/0000\:<bus>\:<device>.<function>/resource0`
Packit 534379
Packit 534379
For example, the example above with bus of 5e, device of 00 and function of 0 would
Packit 534379
use a resource path as follows:
Packit 534379
Packit 534379
`/sys/devices/pci0000\:5e/0000\:5e\:00.0/resource0`
Packit 534379
Packit 534379
Packit 534379
## CSV File Format ##
Packit 534379
Packit 534379
Any CSV file parsed by ```hssi_config``` must meet have at least four columns. The following table provides
Packit 534379
the column specifications:
Packit 534379
Packit 534379
Packit 534379
| Column | Name                        | Description                                                                                  |
Packit 534379
|:------:|-----------------------------|----------------------------------------------------------------------------------------------|
Packit 534379
| 1      | Register type.              | Can be either ```FPGA_RX```, ```FPGA_TX```, ```RTMR_RX```, ```RTMR_TX``` (or their corresponding numeric values, 1-4).|
Packit 534379
| 2      | Lane or Channel             | 0-15 for XCVR lanes on FPGA, 0-3 for retimer channels. -1 to designate all lanes or channels.|
Packit 534379
| 3      | Device address (on I2C bus) | Only applies to retimer registers. 0 - 3, -1 to designate all devices.                        |
Packit 534379
| 4      | Register address (or offset)| Examples: 0x213, 0x100.                                                                      |
Packit 534379
| 5      | Register value to write     | Examples: 0x1, 1, 0. Applies only when loading or writing registers.                            |
Packit 534379
Packit 534379
Packit 534379
Packit 534379
## Examples of Commands ##
Packit 534379
Packit 534379
### Dumping Registers ###
Packit 534379
Packit 534379
Dump default register set to stdout:
Packit 534379
Packit 534379
`>hssi_config dump`
Packit 534379
Packit 534379
Dump default registers to a file, data.csv:
Packit 534379
Packit 534379
`>hssi_config dump data.csv`
Packit 534379
Packit 534379
Dump to an output file, data.csv, Registers specified in an input file, regspec.csv:
Packit 534379
Packit 534379
`>hssi_config dump data.csv --input-file regspec.csv`
Packit 534379
Packit 534379
#### Reading Single Registers ####
Packit 534379
Packit 534379
Read register from XCVR at 0x2e1 on lane 0:
Packit 534379
Packit 534379
`>hssi_config read 0 0x2e1`
Packit 534379
Packit 534379
Read register 0x109 from retimer on channel 0, device 0x30, channel 1:
Packit 534379
Packit 534379
`>hssi_config rread 0 0x30 0x109`
Packit 534379
Packit 534379
### Loading Registers ###
Packit 534379
Packit 534379
Load registers specified in an input file called data.csv:
Packit 534379
Packit 534379
`>hssi_config load data.csv`
Packit 534379
Packit 534379
Load registers specified from stdin:
Packit 534379
Packit 534379
`>hssi_config load`
Packit 534379
Packit 534379
```
Packit 534379
FPGA_RX,1,-1,0x213,0
Packit 534379
FPGA_RX,2,-1,0x213,0
Packit 534379
FPGA_RX,3,-1,0x213,0
Packit 534379
<CTRL-D>
Packit 534379
```
Packit 534379
Packit 534379
#### Writing Single Registers ####
Packit 534379
Packit 534379
Write 1 to XCVR register at 0x2e1 on lane 0:
Packit 534379
Packit 534379
`>hssi_config write 0 0x2e1 1`
Packit 534379
Packit 534379
Read register 0x109 from retimer on channel 0, device 0x30, channel 1:
Packit 534379
Packit 534379
`>hssi_config rread 0 0x30 0x109`
Packit 534379
Packit 534379
## Testing HSSI Read and Write ##
Packit 534379
Packit 534379
Packit 534379
`>  test (rd|rw) register-file.csv [--acktimes]`
Packit 534379
Packit 534379
`rd|wr`
Packit 534379
Packit 534379
Specifies either a `rd` or `wr` of transceiver registers. For writes,
Packit 534379
every register in the file is read from and written to in the following sequence:
Packit 534379
Packit 534379
  1. Read the register, save the value
Packit 534379
  2. Write 1 to the register
Packit 534379
  3. Read the register, verify that the register value is 1
Packit 534379
  4. Write 0 to the register
Packit 534379
  5. Read the register, verify that the register value is 0
Packit 534379
  6. Write the original value to the register
Packit 534379
  7. Read the register, assert it is the original value
Packit 534379
Packit 534379
`register=file.csv`
Packit 534379
Packit 534379
Specifies the path to a file containing the set of registers to test. 
Packit 534379
Packit 534379
`--acktimes ` 
Packit 534379
Packit 534379
Specifies the time spent in the `ack` routine. When measured, a summary of ack times prints 
Packit 534379
to stdout. This argument is optional.
Packit 534379
Packit 534379
## Revision History ##
Packit 534379
Packit 534379
 | Document Version |  Intel Acceleration Stack Version  | Changes  |
Packit 534379
 | ---------------- |------------------------------------|----------|
Packit 534379
 | 2018.05.21 | 1.1 Beta. 
(Supported with Intel Quartus Prime Pro Edition 17.1.) | Corrected typos. |