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

From: Nick Price <nprice_at_FreeBSD.org>
Date: Sun, 16 Aug 2026 17:05:48 UTC
The branch main has been updated by nprice:

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

commit 6dbf809bafe1421fbf3cdd952748b15437b7c72a
Author:     Nick Price <nprice@FreeBSD.org>
AuthorDate: 2026-08-15 02:05:59 +0000
Commit:     Nick Price <nprice@FreeBSD.org>
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 <nprice@FreeBSD.org>
    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);