git: 6dbf809bafe1 - main - aq(4): arm PHY thermal shutdown only where a sensor exists

Nick Price <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.src
Message-ID <6a81edec.30242.43ec705e__36785.9318315581$1786899969$gmane$org@gitrepo.freebsd.org>
The branch main has been updated by nprice:

URL: https://cgit.FreeBSD.org/src/commit/?id=6dbf809bafe1421fbf3cdd952748b15437b7c72a

commit 6dbf809bafe1421fbf3cdd952748b15437b7c72a
Author:     Nick Price <[email protected]>
AuthorDate: 2026-08-15 02:05:59 +0000
Commit:     Nick Price <[email protected]>
CommitDate: 2026-08-16 17:05:23 +0000

    aq(4): arm PHY thermal shutdown only where a sensor exists
    
    aq_fw2x_thermal_arm() reached for a copper PHY register that the fibre
    parts do not implement, so arming failed on every init and printed a
    warning for a capability the hardware cannot have.  Return ENOTSUP when
    the firmware does not advertise a temperature sensor, matching
    aq_fw2x_get_temp(), and warn only for a genuine failure.
    
    Signed-off-by: Nick Price <[email protected]>
    Accepted-by: adrian
    Approved-by: adrian
    (cherry picked from commit 3c7f1aa3b831431193106f8610b2142131d774f5)
---
 sys/dev/aq/aq_fw2x.c |  3 +++
 sys/dev/aq/aq_main.c | 10 ++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/sys/dev/aq/aq_fw2x.c b/sys/dev/aq/aq_fw2x.c
index 91a20cebb7d0..a4e584da2d65 100644
--- a/sys/dev/aq/aq_fw2x.c
+++ b/sys/dev/aq/aq_fw2x.c
@@ -657,6 +657,9 @@ aq_fw2x_thermal_arm(struct aq_hw* hw)
 	uint16_t ctrl;
 	int err;
 
+	if ((hw->fw_caps & FW2X_CAP_TEMPERATURE) == 0)
+		return (ENOTSUP);
+
 	mtx_lock(&hw->fw_mtx);
 	aq_fw2x_phy_id_probe(hw);
 	err = aq_fw2x_phy_read(hw, AQ_PHY_MMD_GLOBAL, AQ_PHY_THERMAL_CTRL_REG,
diff --git a/sys/dev/aq/aq_main.c b/sys/dev/aq/aq_main.c
index 9910c89d1c37..92a6cbde858a 100644
--- a/sys/dev/aq/aq_main.c
+++ b/sys/dev/aq/aq_main.c
@@ -782,10 +782,12 @@ aq_if_init(if_ctx_t ctx)
 	softc->init_retries = 0;
 
 	/* aq_hw_init reloads the PHY, resetting the thermal-shutdown arming. */
-	if (hw->fw_ops->thermal_arm != NULL &&
-	    hw->fw_ops->thermal_arm(hw) != 0)
-		device_printf(softc->dev,
-		    "could not arm PHY thermal shutdown\n");
+	if (hw->fw_ops->thermal_arm != NULL) {
+		err = hw->fw_ops->thermal_arm(hw);
+		if (err != 0 && err != ENOTSUP)
+			device_printf(softc->dev,
+			    "could not arm PHY thermal shutdown\n");
+	}
 
 	aq_if_media_status(ctx, &ifmr);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.