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