Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 May 2019 16:14:03 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r347756 - stable/12/sys/dev/mlx5/mlx5_core
Message-ID:  <201905161614.x4GGE3PC064586@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Thu May 16 16:14:03 2019
New Revision: 347756
URL: https://svnweb.freebsd.org/changeset/base/347756

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

Modified:
  stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c
==============================================================================
--- stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu May 16 16:13:29 2019	(r347755)
+++ stable/12/sys/dev/mlx5/mlx5_core/mlx5_main.c	Thu May 16 16:14:03 2019	(r347756)
@@ -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?201905161614.x4GGE3PC064586>