Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Feb 2024 21:11:03 GMT
From:      "Bjoern A. Zeeb" <bz@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: fcc737d59ead - stable/14 - rtw89: improve debugging and fix a sleep issue
Message-ID:  <202402182111.41ILB327012847@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by bz:

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

commit fcc737d59eade538ee846b6fc63a6068758e2ae6
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-09-06 16:47:45 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2024-02-18 16:41:34 +0000

    rtw89: improve debugging and fix a sleep issue
    
    Improve log messages to be more helpful in error cases.
    Change one LinuxKPI sleep function as we cannot call the original
    one from a context we cannot sleep.
    Both cases were hit during testing.
    
    MFC after:      3 days
    
    (cherry picked from commit 118d0ff54d4f7cffe6a13a1e0cdb2fe23fbfce74)
---
 sys/contrib/dev/rtw89/fw.c  | 9 +++++++++
 sys/contrib/dev/rtw89/phy.c | 4 ++++
 2 files changed, 13 insertions(+)

diff --git a/sys/contrib/dev/rtw89/fw.c b/sys/contrib/dev/rtw89/fw.c
index 17e4ce7cd64a..c1dade182d88 100644
--- a/sys/contrib/dev/rtw89/fw.c
+++ b/sys/contrib/dev/rtw89/fw.c
@@ -903,7 +903,12 @@ static void rtw89_fw_prog_cnt_dump(struct rtw89_dev *rtwdev)
 	for (index = 0; index < 15; index++) {
 		val32 = rtw89_read32(rtwdev, R_AX_DBG_PORT_SEL);
 		rtw89_err(rtwdev, "[ERR]fw PC = 0x%x\n", val32);
+#if defined(__linux__)
 		fsleep(10);
+#elif defined(__FreeBSD__)
+		/* Seems we are called from a context we cannot sleep. */
+		udelay(10);
+#endif
 	}
 }
 
@@ -3890,7 +3895,11 @@ static int rtw89_hw_scan_prehandle(struct rtw89_dev *rtwdev,
 
 	ret = rtw89_hw_scan_update_probe_req(rtwdev, rtwvif);
 	if (ret) {
+#if defined(__linux__)
 		rtw89_err(rtwdev, "Update probe request failed\n");
+#elif defined(__FreeBSD__)
+		rtw89_err(rtwdev, "Update probe request failed: ret %d\n", ret);
+#endif
 		goto out;
 	}
 	ret = rtw89_hw_scan_add_chan_list(rtwdev, rtwvif, connected);
diff --git a/sys/contrib/dev/rtw89/phy.c b/sys/contrib/dev/rtw89/phy.c
index e2b8303d3f63..138788b2ed05 100644
--- a/sys/contrib/dev/rtw89/phy.c
+++ b/sys/contrib/dev/rtw89/phy.c
@@ -1439,7 +1439,11 @@ static void rtw89_phy_init_rf_nctl(struct rtw89_dev *rtwdev)
 	ret = read_poll_timeout(rtw89_phy_nctl_poll, val, val == 0x4, 10,
 				1000, false, rtwdev);
 	if (ret)
+#if defined(__linux__)
 		rtw89_err(rtwdev, "failed to poll nctl block\n");
+#elif defined(__FreeBSD__)
+		rtw89_err(rtwdev, "failed to poll nctl block: ret %d val %#06x\n", ret, val);
+#endif
 
 	nctl_table = elm_info->rf_nctl ? elm_info->rf_nctl : chip->nctl_table;
 	rtw89_phy_init_reg(rtwdev, nctl_table, rtw89_phy_config_bb_reg, NULL);



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