1e808190aSHans Petter Selasky.\" 2ff08edcbSHans Petter Selasky.\" Copyright (c) 2018, 2019 Mellanox Technologies 3e808190aSHans Petter Selasky.\" All rights reserved. 4e808190aSHans Petter Selasky.\" 5e808190aSHans Petter Selasky.\" Redistribution and use in source and binary forms, with or without 6e808190aSHans Petter Selasky.\" modification, are permitted provided that the following conditions 7e808190aSHans Petter Selasky.\" are met: 8e808190aSHans Petter Selasky.\" 1. Redistributions of source code must retain the above copyright 9e808190aSHans Petter Selasky.\" notice, this list of conditions and the following disclaimer. 10e808190aSHans Petter Selasky.\" 2. Redistributions in binary form must reproduce the above copyright 11e808190aSHans Petter Selasky.\" notice, this list of conditions and the following disclaimer in the 12e808190aSHans Petter Selasky.\" documentation and/or other materials provided with the distribution. 13e808190aSHans Petter Selasky.\" 14e808190aSHans Petter Selasky.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15e808190aSHans Petter Selasky.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16e808190aSHans Petter Selasky.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17e808190aSHans Petter Selasky.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18e808190aSHans Petter Selasky.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19e808190aSHans Petter Selasky.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20e808190aSHans Petter Selasky.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21e808190aSHans Petter Selasky.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22e808190aSHans Petter Selasky.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23e808190aSHans Petter Selasky.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24e808190aSHans Petter Selasky.\" SUCH DAMAGE. 25e808190aSHans Petter Selasky.\" 26e808190aSHans Petter Selasky.\" $FreeBSD$ 27e808190aSHans Petter Selasky.\" 28b255ca09SHans Petter Selasky.Dd May 7, 2019 29e808190aSHans Petter Selasky.Dt mlx5io 4 30e808190aSHans Petter Selasky.Os 31e808190aSHans Petter Selasky.Sh NAME 32e808190aSHans Petter Selasky.Nm mlx5io 33e808190aSHans Petter Selasky.Nd IOCTL interface to manage Connect-X 4/5 Mellanox network adapters 34e808190aSHans Petter Selasky.Sh SYNOPSIS 35e808190aSHans Petter Selasky.In dev/mlx5/mlx5io.h 36e808190aSHans Petter Selasky.Sh DESCRIPTION 37e808190aSHans Petter SelaskyThe 38e808190aSHans Petter Selasky.Nm 39e808190aSHans Petter Selaskyinterface is provided for management of the Connect-X 4 and 5 network adapters 40e808190aSHans Petter Selaskyin the aspects not covered by the generic network configuration, 41e808190aSHans Petter Selaskymostly related to the PCIe attachment and internal card working. 42e808190aSHans Petter SelaskyInterface consists of the commands, which are passed by means of 43e808190aSHans Petter Selasky.Xr ioctl 2 44e808190aSHans Petter Selaskyon the file descriptor, opened from the 45e808190aSHans Petter Selasky.Pa /dev/mlx5ctl 46e808190aSHans Petter Selaskydevice node. 47e808190aSHans Petter Selasky.Pp 48e808190aSHans Petter SelaskyThe following commands are implemented: 49e808190aSHans Petter Selasky.Bl -tag -width indent 50e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_FORCE 51e808190aSHans Petter SelaskyTake the snapshot of the firmware registers state and store it in the 52e808190aSHans Petter Selaskykernel buffer. 53e808190aSHans Petter SelaskyThe buffer must be empty, in other words, no dumps should be written so 54e808190aSHans Petter Selaskyfar, or existing dump cleared with the 55e808190aSHans Petter Selasky.Dv MLX5_FWDUMP_RESET 56e808190aSHans Petter Selaskycommand for the specified device. 57e808190aSHans Petter SelaskyThe argument for the command should point to the 58b255ca09SHans Petter Selasky.Vt struct mlx5_tool_addr 59e808190aSHans Petter Selaskystructure, containing the PCIe bus address of the device. 60e808190aSHans Petter Selasky.Bd -literal 61b255ca09SHans Petter Selaskystruct mlx5_tool_addr { 62e808190aSHans Petter Selasky uint32_t domain; 63e808190aSHans Petter Selasky uint8_t bus; 64e808190aSHans Petter Selasky uint8_t slot; 65e808190aSHans Petter Selasky uint8_t func; 66e808190aSHans Petter Selasky}; 67e808190aSHans Petter Selasky.Ed 68e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_RESET 69e808190aSHans Petter SelaskyClear the stored firmware dump, preparing the kernel buffer for 70e808190aSHans Petter Selaskythe next dump. 71e808190aSHans Petter SelaskyThe argument for the command should point to the 72b255ca09SHans Petter Selasky.Vt struct mlx5_tool_addr 73e808190aSHans Petter Selaskystructure, containing the PCIe bus address of the device. 74e808190aSHans Petter Selasky.It Dv MLX5_FWDUMP_GET 75e808190aSHans Petter SelaskyFetch the stored firmware dump into the user memory. 76e808190aSHans Petter SelaskyThe argument to the command should point to the input/output 77e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_get 78e808190aSHans Petter Selaskystructure. 79e808190aSHans Petter SelaskyIts 80e808190aSHans Petter Selasky.Dv devaddr 81e808190aSHans Petter Selaskyfield specifies the address of the device, the 82e808190aSHans Petter Selasky.Dv buf 83e808190aSHans Petter Selaskyfields points to the array of 84e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_reg 85e808190aSHans Petter Selaskyof records of the registers values, the size of the array is specified 86e808190aSHans Petter Selaskyin the 87e808190aSHans Petter Selasky.Dv reg_cnt 88e808190aSHans Petter Selaskyfield. 89e808190aSHans Petter Selasky.Bd -literal 90e808190aSHans Petter Selaskystruct mlx5_fwdump_get { 91b255ca09SHans Petter Selasky struct mlx5_tool_addr devaddr; 92e808190aSHans Petter Selasky struct mlx5_fwdump_reg *buf; 93e808190aSHans Petter Selasky size_t reg_cnt; 94e808190aSHans Petter Selasky size_t reg_filled; /* out */ 95e808190aSHans Petter Selasky}; 96e808190aSHans Petter Selasky.Ed 97e808190aSHans Petter Selasky.Pp 98e808190aSHans Petter SelaskyOn successfull return, the 99e808190aSHans Petter Selasky.Dv reg_filled 100e808190aSHans Petter Selaskyfield reports the number of the 101e808190aSHans Petter Selasky.Dv buf 102e808190aSHans Petter Selaskyarray elements actually filled with the registers values. 103e808190aSHans Petter SelaskyIf 104e808190aSHans Petter Selasky.Dv buf 105e808190aSHans Petter Selaskycontains the 106e808190aSHans Petter Selasky.Dv NULL 107e808190aSHans Petter Selaskypointer, no registers are filled, but 108e808190aSHans Petter Selasky.Dv reg_filled 109e808190aSHans Petter Selaskystill contains the number of registers that should be passed for 110e808190aSHans Petter Selaskythe complete dump. 111e808190aSHans Petter Selasky.Pp 112e808190aSHans Petter SelaskyThe 113e808190aSHans Petter Selasky.Vt struct mlx5_fwdump_reg 114e808190aSHans Petter Selaskyelement contains the address of the register in the field 115e808190aSHans Petter Selasky.Dv addr , 116e808190aSHans Petter Selaskyand its value in the field 117e808190aSHans Petter Selasky.Dv val . 118e808190aSHans Petter Selasky.Bd -literal 119e808190aSHans Petter Selaskystruct mlx5_fwdump_reg { 120e808190aSHans Petter Selasky uint32_t addr; 121e808190aSHans Petter Selasky uint32_t val; 122e808190aSHans Petter Selasky}; 123e808190aSHans Petter Selasky.Ed 124ff08edcbSHans Petter Selasky.It Dv MLX5_FW_UPDATE 125ff08edcbSHans Petter SelaskyRequests firmware update (flash) on the adapter specified by the 126ff08edcbSHans Petter Selasky.Dv devaddr 127ff08edcbSHans Petter Selaskyusing the firmware image in 128ff08edcbSHans Petter Selasky.Dv MFA2 129ff08edcbSHans Petter Selaskyformat. 130ff08edcbSHans Petter SelaskyThe argument for the ioctl command is the 131ff08edcbSHans Petter Selasky.Vt struct mlx5_fw_update 132ff08edcbSHans Petter Selaskywith the following definition. 133ff08edcbSHans Petter Selasky.Bd -literal 134ff08edcbSHans Petter Selaskystruct mlx5_fw_update { 135ff08edcbSHans Petter Selasky struct mlx5_tool_addr devaddr; 136ff08edcbSHans Petter Selasky void *img_fw_data; 137ff08edcbSHans Petter Selasky size_t img_fw_data_len; 138ff08edcbSHans Petter Selasky}; 139ff08edcbSHans Petter Selasky.Ed 140ff08edcbSHans Petter SelaskyImage address in memory is passed in 141ff08edcbSHans Petter Selasky.Dv img_fw_data , 142ff08edcbSHans Petter Selaskythe length of the image is specified in 143ff08edcbSHans Petter Selasky.Dv img_fw_data_len 144ff08edcbSHans Petter Selaskyfield. 145*998c9a2bSHans Petter Selasky.It Dv MLX5_FW_RESET 146*998c9a2bSHans Petter SelaskyRequests PCIe link-level reset on the device. 147*998c9a2bSHans Petter SelaskyThe address of the device is specified by the 148*998c9a2bSHans Petter Selasky.Vt struct mlx5_tool_addr 149*998c9a2bSHans Petter Selaskystructure, which should be passed as an argument. 150e808190aSHans Petter Selasky.El 151e808190aSHans Petter Selasky.Sh FILES 152e808190aSHans Petter SelaskyThe 153e808190aSHans Petter Selasky.Pa /dev/mlx5ctl 154e808190aSHans Petter Selasky.Xr devfs 5 155e808190aSHans Petter Selaskynode is used to pass commands to the driver. 156e808190aSHans Petter Selasky.Sh RETURN VALUES 157e808190aSHans Petter SelaskyIf successful, the IOCTL returns zero. 158e808190aSHans Petter SelaskyOtherwise, -1 is returned and the global variable 159e808190aSHans Petter Selasky.Va errno 160e808190aSHans Petter Selaskyis set to indicate the error. 161e808190aSHans Petter Selasky.Sh SEE ALSO 162e808190aSHans Petter Selasky.Xr errno 2 , 163e808190aSHans Petter Selasky.Xr ioctl 2 , 164e808190aSHans Petter Selasky.Xr mlx5en 4 , 165e808190aSHans Petter Selasky.Xr mlx5ib 4 , 166e808190aSHans Petter Selasky.Xr mlx5tool 8 167e808190aSHans Petter Selaskyand 168e808190aSHans Petter Selasky.Xr pci 9 . 169