Blame doc/src/fpga_tools/fpgaflash/superrsu.md

Packit 534379
# super-rsu #
Packit 534379
Packit 534379
## SYNOPSIS ##
Packit 534379
```console
Packit 534379
super-rsu [-h] [-n] [--verify] | [ [--log-level {trace,debug,error,warn,info,notset}]
Packit 534379
          [--log-file <filename>] [--rsu-only] [--with-rsu] [--force-flash] ]
Packit 534379
 	  rsu_config
Packit 534379
```
Packit 534379
Packit 534379
Packit 534379
## DESCRIPTION ##
Packit 534379
super-rsu is a tool that can be used for flashing image files and commanding an
Packit 534379
Intel PAC device to perform RSU (remote system update - or a board reboot).
Packit 534379
Performing an RSU on an Intel PAC device will cause it to reload any firmware
Packit 534379
or programmable logic and restart its execution, a requirement for any updated
Packit 534379
firmware or programmable logic to take effect.
Packit 534379
Packit 534379
At the core of super-rsu is its configuration file (referred to in this
Packit 534379
document as 'rsu_config') which is essentially a manifest file for
Packit 534379
identifying both the target device and the binary images (and their versions)
Packit 534379
to be flashed.
Packit 534379
Packit 534379
At a high level, the flow of super-rsu should be:
Packit 534379
1. Read and parse rsu_config file
Packit 534379
2. Use product identifiers (like vendor, device and any additional vendor, device
Packit 534379
   pairs that may be present in the PCIe bus) to locate all compatible
Packit 534379
   devices on the PCIe bus.
Packit 534379
3. For every device found on the system, update the device using the flash
Packit 534379
   images defined in the "flash" section in the rsu_config data (or nvmupdate
Packit 534379
   section).
Packit 534379
   Each item in the "flash" section is a "flash spec" that contains:
Packit 534379
   * The flash type ("user", "bmc_fw", "bmc_img", ...)
Packit 534379
   * The filename of the image to flash. super-rsu will look for this file
Packit 534379
     first in the same directory of the rsu_config file, and then look in the
Packit 534379
     current working directory.
Packit 534379
   * The version of the image.
Packit 534379
   * An optional "force" indicator
Packit 534379
   * An optional "requires" indicator
Packit 534379
   The "nvmupdate" section is used to describe an Ethernet firmware file and
Packit 534379
   its version.
Packit 534379
4. Using the data in the "nvmupdate" and "flash" sections, the update routine
Packit 534379
   involves:
Packit 534379
  * If an "nvmupdate" section is present:
Packit 534379
    1. Locate the file on the file system to use to flash the Ethernet device.
Packit 534379
    2. Call nvmupdate to get an "inventory" of devices matching the vendor and
Packit 534379
       device id in this section.
Packit 534379
    3. Use this data to dynamically generate an nvmupdate compatible
Packit 534379
       configuration file.
Packit 534379
    4. Call nvmupdate with the generated configuration file to flash the
Packit 534379
       Ethernet interfaces in the Vista Creek card (if version reported by
Packit 534379
       system does not match the version in this section).
Packit 534379
  * For each spec in the "flash" section:
Packit 534379
    1. Locate the file on the file system to use to flash.
Packit 534379
    2. Compare the version listed in the "flash spec" to version reported by
Packit 534379
       the target component.
Packit 534379
    3. Create a task to call fpgaflash if either of the following conditions is
Packit 534379
       met (and the revision specified is compatible):
Packit 534379
       * The "force" indicator is present and set to true.
Packit 534379
       * The version in the spec does not match the version reported by the
Packit 534379
         system OR the flash type is factory type.
Packit 534379
  * For each task created from the "flash" section:
Packit 534379
    1. Call fpgaflash with the command line arguments that correspond to the
Packit 534379
       flash type and the file name in the spec used to create the task.
Packit 534379
       This opens and controls the execution of fpgaflash in another process.
Packit 534379
Packit 534379
_NOTE_: If the system reports a revision for one of the components
Packit 534379
being flashed, this revision must be in the set of revisions listed
Packit 534379
in the manifest.
Packit 534379
Example: if the system reports 'a' for bmc_img and the manifest includes
Packit 534379
'ab', then the image will be flashed.
Packit 534379
Packit 534379
_NOTE_: Each update routine is run in a thread specific to a device located
Packit 534379
on the PCIe bus. Every task in an update routine involves opening a new process
Packit 534379
that is controlled and managed by its update routine thread.
Packit 534379
If a task includes a timeout and the timeout is reached, a termination request
Packit 534379
will be sent to its process and it will be counted as a failure. If a global
Packit 534379
timeout is reached in the main thread, a termination request will be sent to each
Packit 534379
thread performing the update. Consequently, the update routine will give the
Packit 534379
current task extra time before terminating the process.
Packit 534379
The RSU operation will only be performed if requested with either `--with-rsu`
Packit 534379
command line argument or with the `--rsu-only` command line argument.
Packit 534379
The former will perform the RSU command upon successful completion of flash
Packit 534379
operations. The latter will skip the process of version matching and flashing
Packit 534379
images and will only perform the RSU command. It is recommended that super-rsu
Packit 534379
be executed again if any flash operation is interrupted.
Packit 534379
Packit 534379
## POSITIONAL ARGUMENTS ##
Packit 534379
`rsu config`
Packit 534379
Packit 534379
Specifies the name of the file containing the RSU configuration (in JSON
Packit 534379
format)
Packit 534379
Packit 534379
Packit 534379
## OPTIONAL ARGUMENTS ##
Packit 534379
`-h, --help`
Packit 534379
Packit 534379
   Print usage information.
Packit 534379
Packit 534379
`--verify`
Packit 534379
Packit 534379
  Compare versions of flashable components on the system against the manifest.
Packit 534379
  Return non-zero exit if compatible components are not up to date.
Packit 534379
Packit 534379
`-n, --dry-run`
Packit 534379
Packit 534379
  Don't perform any updates, just a dry run.
Packit 534379
  This will print out commands that can be executed
Packit 534379
  in a Linux shell.
Packit 534379
Packit 534379
`--log-level {trace,debug,error,warn,info,notset}`
Packit 534379
Packit 534379
  Log level to use. Default is 'info'.
Packit 534379
Packit 534379
`--log-file <filename> (default: /tmp/super-rsu.log)
Packit 534379
Packit 534379
  Emit log messages (with DEBUG level) to filename
Packit 534379
  _NOTE_: The default log file (/tmp/super-rsu.log) is set to rollover every
Packit 534379
  time super-rsu is executed. This will create numbered backups before
Packit 534379
  truncating the log file. The maximum number of backups is 50.
Packit 534379
Packit 534379
`--rsu-only`
Packit 534379
Packit 534379
  Only perform the RSU command.
Packit 534379
Packit 534379
`--with-rsu`
Packit 534379
Packit 534379
  Perform RSU after updating flash components(experimental)
Packit 534379
Packit 534379
`--force-flash`
Packit 534379
Packit 534379
  Flash all images regardless of versions matching or not.
Packit 534379
Packit 534379
Packit 534379
## CONFIGURATION ##
Packit 534379
The following is the JSON schema expected by super-rsu. Any deviance from
Packit 534379
this schema may result in errors executing super-rsu.
Packit 534379
Packit 534379
```JSON
Packit 534379
{
Packit 534379
  "definitions": {},
Packit 534379
  "$schema": "http://json-schema.org/draft-07/schema#",
Packit 534379
  "$id": "http://example.com/root.json",
Packit 534379
  "type": "object",
Packit 534379
  "title": "The Root Schema",
Packit 534379
  "required": [
Packit 534379
    "product",
Packit 534379
    "vendor",
Packit 534379
    "device",
Packit 534379
    "flash"
Packit 534379
  ],
Packit 534379
  "optional": [
Packit 534379
    "nvmupdate",
Packit 534379
  ],
Packit 534379
  "properties": {
Packit 534379
    "product": {
Packit 534379
      "$id": "#/properties/product",
Packit 534379
      "type": "string",
Packit 534379
      "title": "The Product Schema",
Packit 534379
      "default": "",
Packit 534379
      "examples": [
Packit 534379
        "n3000"
Packit 534379
      ],
Packit 534379
      "pattern": "^(.*)$"
Packit 534379
    },
Packit 534379
    "vendor": {
Packit 534379
      "$id": "#/properties/vendor",
Packit 534379
      "type": "string",
Packit 534379
      "title": "The Vendor Schema",
Packit 534379
      "default": "",
Packit 534379
      "examples": [
Packit 534379
        "0x8086"
Packit 534379
      ],
Packit 534379
      "pattern": "^((0x)?[A-Fa-f0-9]{4})$"
Packit 534379
    },
Packit 534379
    "device": {
Packit 534379
      "$id": "#/properties/device",
Packit 534379
      "type": "string",
Packit 534379
      "title": "The Device Schema",
Packit 534379
      "default": "",
Packit 534379
      "examples": [
Packit 534379
        "0x0b30"
Packit 534379
      ],
Packit 534379
      "pattern": "^((0x)?[A-Fa-f0-9]{4})$"
Packit 534379
    },
Packit 534379
    "nvmupdate": {
Packit 534379
      "$id": "#/properties/nvmupdate",
Packit 534379
      "type": "object",
Packit 534379
      "title": "The nvmupdate Schema",
Packit 534379
      "required": [
Packit 534379
        "vendor",
Packit 534379
        "device",
Packit 534379
        "filename",
Packit 534379
        "version"
Packit 534379
      ],
Packit 534379
      "optional": [
Packit 534379
        "interfaces"
Packit 534379
      ],
Packit 534379
      "properties": {
Packit 534379
        "vendor": {
Packit 534379
          "$id": "#/properties/nvmupdate/vendor",
Packit 534379
          "type": "string",
Packit 534379
          "title": "The nvmupdate Vendor Schema",
Packit 534379
          "default": "",
Packit 534379
          "examples": [
Packit 534379
             "0x8086"
Packit 534379
          ],
Packit 534379
          "pattern": "^((0x)?[A-Fa-f0-9]{4})$"
Packit 534379
        },
Packit 534379
        "device": {
Packit 534379
          "$id": "#/properties/nvmupdate/device",
Packit 534379
          "type": "string",
Packit 534379
          "title": "The nvmupdate Device Schema",
Packit 534379
          "default": "",
Packit 534379
          "examples": [
Packit 534379
            "0x0d58"
Packit 534379
          ],
Packit 534379
          "pattern": "^((0x)?[A-Fa-f0-9]{4})$"
Packit 534379
        },
Packit 534379
        "interfaces": {
Packit 534379
          "$id": "#/properties/nvmupdate/interfaces",
Packit 534379
          "type": "number",
Packit 534379
          "title": "The nvmupdate Interfaces Schema",
Packit 534379
          "default": "1",
Packit 534379
          "examples": [
Packit 534379
            2, 4
Packit 534379
          ]
Packit 534379
        },
Packit 534379
        "filename": {
Packit 534379
          "$id": "#/properties/nvmupdate/filename",
Packit 534379
          "type": "string",
Packit 534379
          "title": "The nvmupdate Filename Schema",
Packit 534379
          "default": "",
Packit 534379
          "examples": [
Packit 534379
            "PSG_XL710_6p80_XLAUI_NCSI_CFGID2p61_Dual_DID_0D58_800049C6.bin"
Packit 534379
          ],
Packit 534379
          "pattern": "^(.*)$"
Packit 534379
        },
Packit 534379
        "version": {
Packit 534379
          "$id": "#/properties/nvmupdate/version",
Packit 534379
          "type": "string",
Packit 534379
          "title": "The nvmupdate Version Schema",
Packit 534379
          "default": "",
Packit 534379
          "examples": [
Packit 534379
            "800049C6"
Packit 534379
          ],
Packit 534379
          "pattern": "^((0x)?[A-Fa-f0-9]{8})$"
Packit 534379
        },
Packit 534379
        "timeout": {
Packit 534379
          "$id": "#/properties/nvmupdate/timeout",
Packit 534379
          "type": "string",
Packit 534379
          "title": "The Timeout Schema",
Packit 534379
          "default": "",
Packit 534379
          "examples": [
Packit 534379
            "10m"
Packit 534379
          ],
Packit 534379
          "pattern": "^([0-9]+(\\.[0-9]+)?([dhms]))+$"
Packit 534379
        }
Packit 534379
      }
Packit 534379
    },
Packit 534379
    "flash": {
Packit 534379
      "$id": "#/properties/flash",
Packit 534379
      "type": "array",
Packit 534379
      "title": "The Flash Schema",
Packit 534379
      "items": {
Packit 534379
        "$id": "#/properties/flash/items",
Packit 534379
        "type": "object",
Packit 534379
        "title": "The Items Schema",
Packit 534379
        "required": [
Packit 534379
          "filename",
Packit 534379
          "type",
Packit 534379
          "version",
Packit 534379
          "revision"
Packit 534379
        ],
Packit 534379
	"optional": [
Packit 534379
          "enabled",
Packit 534379
          "force",
Packit 534379
	  "timeout",
Packit 534379
	  "requires"
Packit 534379
	],
Packit 534379
        "properties": {
Packit 534379
	  "enabled": {
Packit 534379
            "$id": "#/properties/flash/items/properties/enabled",
Packit 534379
	    "type": "boolean",
Packit 534379
	    "title": "The Enabled Schema",
Packit 534379
	    "default": "true"
Packit 534379
	  },
Packit 534379
          "filename": {
Packit 534379
            "$id": "#/properties/flash/items/properties/filename",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Filename Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "vista_creek_qspi_xip_v1.0.6.ihex"
Packit 534379
            ],
Packit 534379
            "pattern": "^(.*)$"
Packit 534379
          },
Packit 534379
          "type": {
Packit 534379
            "$id": "#/properties/flash/items/properties/type",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Type Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "bmc_fw"
Packit 534379
            ],
Packit 534379
            "enum": ["user", "bmc_fw", "bmc_img", "dtb", "factory_only",
Packit 534379
	    "phy_eeprom"]
Packit 534379
          },
Packit 534379
          "version": {
Packit 534379
            "$id": "#/properties/flash/items/properties/version",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Version Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "1.0.6"
Packit 534379
            ],
Packit 534379
            "pattern": "^\\d+\\.\\d+\\.\\d+$"
Packit 534379
          },
Packit 534379
          "force": {
Packit 534379
            "$id": "#/properties/flash/items/properties/force",
Packit 534379
            "type": "boolean",
Packit 534379
            "title": "The Force Schema",
Packit 534379
            "default": false,
Packit 534379
            "examples": [
Packit 534379
              true
Packit 534379
            ]
Packit 534379
          },
Packit 534379
          "revision": {
Packit 534379
            "$id": "#/properties/flash/items/properties/revision",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Revision Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "C"
Packit 534379
            ],
Packit 534379
            "pattern": "^([A-Za-z])$"
Packit 534379
          },
Packit 534379
          "timeout": {
Packit 534379
            "$id": "#/properties/nvmupdate/timeout",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Timeout Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "10m"
Packit 534379
            ],
Packit 534379
            "pattern": "^([0-9]+(\.[0-9]+)?([dhms]))+$"
Packit 534379
          },
Packit 534379
          "requires": {
Packit 534379
            "$id": "#/properties/flash/items/properties/requires",
Packit 534379
            "type": "string",
Packit 534379
            "title": "The Requires Schema",
Packit 534379
            "default": "",
Packit 534379
            "examples": [
Packit 534379
              "bmc_img >= 1.0.12"
Packit 534379
            ],
Packit 534379
            "pattern": "^(([a-z_]+) ((<>!=)?=) ([0-9a-z\\.]+)$"
Packit 534379
          }
Packit 534379
        }
Packit 534379
      }
Packit 534379
    }
Packit 534379
  }
Packit 534379
}
Packit 534379
```