From nobody Tue Dec 31 01:36:05 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4YMbCT6xQGz5jKyd; Tue, 31 Dec 2024 01:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YMbCT44zKz4hkf; Tue, 31 Dec 2024 01:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735608965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a1YYBn8NhTJNgNLthY9XsCveHvfwlKaQL0p3kAXdsKo=; b=gvehfxN6Npki3/uOWsKlnTIm7b9nCAAsrYIgoNEW6sqi5Qq89LDnbU9prgz3QmDrtSQN4p fAucmWuQkR98p2ShYyBGJN5OJFjy0DaCKXG0ILnISfwIrpkzVGnX5kN73tdaKBX9zQO3X6 2/bViVWJQ3nmPAV0ozhuRXN0PxryhUO2jW10ahULYPVqSSm0flzONp18lCP8rkikdti8At 3lPzpJWYXEaxs3FWHwFm+1JisAVWzRrPCzgAjkvO4yDZAtpw//LgutlbNA+AR81ef0IBf7 Kr4p9ULjd30P4pJR0HQiek6jz9DEHcFzjNTgGfAHz6hllUY8o9SjcrzmrlZqEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1735608965; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=a1YYBn8NhTJNgNLthY9XsCveHvfwlKaQL0p3kAXdsKo=; b=hjkYnvoB9LCA/swJcLzbri4BNYZGqy3Zlo6whfy+tZtfpsZG9Ven4eF4S93Qg08rRKmOre OHz36dsmhZIG9Oem15l3mpTxEGGfudhRYr48yMHOIkzjG3bdPTCimOa+iGm8cL/6b1Cm0b SueHCYnIxRoxFLm7+KHQF1WXgLIJLUYnnR8vGqtn9CI8ca/WTPhXSxb7VFGTuddq7UJmQP uSOUWoUsti7/5CTNmaFToZvEqIFMSyuB3RqCxPlSN9xfMlqUjd0+h9lWHzmrbzYSjhMdd0 R4VWsBtVPJYBI/bIhb7nY48zeFjMeaKIRsnIUnfydTmJeBOxhYstyiEsqTLoKg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1735608965; a=rsa-sha256; cv=none; b=GjuizQBXVbKWakRwF1ixRujWcVAQjYXtG6wPfeActnICDfolbEQMmi8dNd23exh5XX+sbi KA46lUsrvdGr1gg4a6Hz9gCg3DRYS6LrkKAx+/+81V9eR+LtvIA5BHvs5rFYDzzKU1+Z+M TlLtIoY1dZJpXikym0x54cJg7naJpIZjMRxW1ECH3wf2NKYEYLU2A0ML2sEFYOIW4/Y+1c GSSx+/gxvppwhdjkKZwoZpVbM3GzLkSsCZ9w37vRdApNRWwAeuqXwOXOV5I4M+oLiB2Gye XBMXfr+SLZCEjZfgui0P/tbJw+sqyaSeWbYTG+X2kdbl2vk7qGasSdD1G54Bgw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4YMbCT3hw9zJGQ; Tue, 31 Dec 2024 01:36:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4BV1a5i6060847; Tue, 31 Dec 2024 01:36:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4BV1a5FN060844; Tue, 31 Dec 2024 01:36:05 GMT (envelope-from git) Date: Tue, 31 Dec 2024 01:36:05 GMT Message-Id: <202412310136.4BV1a5FN060844@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Adrian Chadd Subject: git: cc3b7b7e715d - main - ath_hal_ar9300: implement the TX/RX chainmask override for AR9300 HAL List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: adrian X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: cc3b7b7e715dde516752c479bc67eb93467d86a6 Auto-Submitted: auto-generated The branch main has been updated by adrian: URL: https://cgit.FreeBSD.org/src/commit/?id=cc3b7b7e715dde516752c479bc67eb93467d86a6 commit cc3b7b7e715dde516752c479bc67eb93467d86a6 Author: Adrian Chadd AuthorDate: 2024-12-29 05:25:42 +0000 Commit: Adrian Chadd CommitDate: 2024-12-31 01:35:56 +0000 ath_hal_ar9300: implement the TX/RX chainmask override for AR9300 HAL This commit implements the missing capability set handlers for setting the transmit and receive chainmasks. I did this for the AR5416 and later chips years ago, but not for these. This is especially useful when you're only hooking up one or two antennas on a 3 antenna device - or you just want to test it like that. It also requires updating the number of supported transmit/receive streams, so also add them here. Locally Tested: * AR9300, STA mode, 1, 2 and 3 stream TX/RX configuration Differential Revision: https://reviews.freebsd.org/D48240 --- sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c | 2 +- sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c | 29 +++++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c index ca41cae2c5eb..26ef2c67b882 100644 --- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c +++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_attach.c @@ -2751,7 +2751,7 @@ ar9300_fill_capability_info(struct ath_hal *ah) /* FreeBSD: Update number of TX/RX streams */ p_cap->halTxStreams = owl_get_ntxchains(p_cap->halTxChainMask); p_cap->halRxStreams = owl_get_ntxchains(p_cap->halRxChainMask); - +#undef owl_get_ntxchains /* * This being a newer chip supports TKIP non-splitmic mode. diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c index 1793cf06378b..94bcc1777f27 100644 --- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c +++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300_misc.c @@ -968,7 +968,7 @@ ar9300_set_capability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, u_int32_t capability, u_int32_t setting, HAL_STATUS *status) { struct ath_hal_9300 *ahp = AH9300(ah); - const HAL_CAPABILITIES *p_cap = &AH_PRIVATE(ah)->ah_caps; + HAL_CAPABILITIES *p_cap = &AH_PRIVATE(ah)->ah_caps; u_int32_t v; switch (type) { @@ -1079,6 +1079,33 @@ ar9300_set_capability(struct ath_hal *ah, HAL_CAPABILITY_TYPE type, return AH_TRUE; } return AH_FALSE; + +#define owl_get_ntxchains(_txchainmask) \ + (((_txchainmask >> 2) & 1) + ((_txchainmask >> 1) & 1) + \ + (_txchainmask & 1)) + + case HAL_CAP_RX_CHAINMASK: + setting &= ar9300_eeprom_get(ahp, EEP_RX_MASK); + p_cap->halRxChainMask = setting; + p_cap->halRxStreams = owl_get_ntxchains(setting); + if (p_cap->halRxStreams > 3) + p_cap->halRxStreams = 3; + else if (p_cap->halRxStreams < 1) + p_cap->halRxStreams = 1; + return AH_TRUE; + + case HAL_CAP_TX_CHAINMASK: + setting &= ar9300_eeprom_get(ahp, EEP_TX_MASK); + p_cap->halTxChainMask = setting; + p_cap->halTxStreams = owl_get_ntxchains(setting); + if (p_cap->halTxStreams > 3) + p_cap->halTxStreams = 3; + else if (p_cap->halTxStreams < 1) + p_cap->halTxStreams = 1; + return AH_TRUE; + +#undef owl_get_ntxchains + /* fall thru... */ default: return ath_hal_setcapability(ah, type, capability, setting, status);