Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 May 2019 10:52:11 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347292 - head/sys/dev/mlx5/mlx5_core
Message-ID:  <201905081052.x48AqB3f055887@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Wed May  8 10:52:11 2019
New Revision: 347292
URL: https://svnweb.freebsd.org/changeset/base/347292

Log:
  Add mlx5_firmware_update() in mlx5core.
  Add support for upgrading firmware on mlx5 module load.
  
  Submitted by:	slavash@
  MFC after:	3 days
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Wed May  8 10:51:49 2019	(r347291)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c	Wed May  8 10:52:11 2019	(r347292)
@@ -52,6 +52,7 @@ MODULE_DESCRIPTION("Mellanox Connect-IB, ConnectX-4 co
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_DEPEND(mlx5, linuxkpi, 1, 1, 1);
 MODULE_DEPEND(mlx5, mlxfw, 1, 1, 1);
+MODULE_DEPEND(mlx5, firmware, 1, 1, 1);
 MODULE_VERSION(mlx5, 1);
 
 SYSCTL_NODE(_hw, OID_AUTO, mlx5, CTLFLAG_RW, 0, "mlx5 hardware controls");
@@ -820,6 +821,23 @@ void *mlx5_get_protocol_dev(struct mlx5_core_dev *mdev
 }
 EXPORT_SYMBOL(mlx5_get_protocol_dev);
 
+static int
+mlx5_firmware_update(struct mlx5_core_dev *dev)
+{
+	const struct firmware *fw;
+	int err;
+
+	fw = firmware_get("mlx5fw_mfa");
+	if (fw) {
+		err = mlx5_firmware_flash(dev, fw);
+		firmware_put(fw, FIRMWARE_UNLOAD);
+	}
+	else
+		return (-ENOENT);
+
+	return err;
+}
+
 static int mlx5_pci_init(struct mlx5_core_dev *dev, struct mlx5_priv *priv)
 {
 	struct pci_dev *pdev = dev->pdev;
@@ -1274,6 +1292,8 @@ static int init_one(struct pci_dev *pdev,
 	}
 
 	mlx5_fwdump_prep(dev);
+
+	mlx5_firmware_update(dev);
 
 	pci_save_state(bsddev);
 	return 0;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905081052.x48AqB3f055887>