From nobody Sun Apr 23 21:31:37 2023 X-Original-To: dev-commits-src-main@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 4Q4M0B3DTnz46W4d; Sun, 23 Apr 2023 21:31:38 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Q4M0B0xbmz3DFW; Sun, 23 Apr 2023 21:31:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682285498; 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=ISVELRDZTBEFh1XCtdMZ8J0PxWvpNFxT4RZzT5g0eec=; b=eyXmfH1MjoiWu5mGkOblomqYDpJNngzvR7r0NlCQHpI9rifEoLQyJK0tghWYGDo68+l6Vw EKo2NdlVZGLelXec6piThO4vXQGOFlagvMzsyIVRbKZuGS+pAtczWTIpyOlPRQO0ZPunQx QkSmAV8A7JfZ592lenYzdbcXWa6Mbe/VCPv+5QIUVOV+Pjefu2VuIE7DtL7jeZqZ12F7TC Q66n7n2b7vbvomwrihYcE2JFJ71uJbGc+ZvMe/letBg3LTb6DX/AzL/F09vIyV4N9E2U5l gzZH/sLpntj0y8OlGQYBmfNbMlqqDIWVFhomGUih4rEPF0jMjNXtwUt6ytDUGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1682285498; 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=ISVELRDZTBEFh1XCtdMZ8J0PxWvpNFxT4RZzT5g0eec=; b=yVHmX6a9jBpwgDimpI2moYjjHxbhtZ2Kf1MoFHO+FSyf/C2IfTAfw42PruKdFPOYS+7t4o pRJxnDkPG+T9njanyN9WhFc21WyOpA40Wgyr7AQsHTPsae8Vn0Her0opB/Nb1RITS3UrDA T/eFWfw3K2kh0CaegoK4e9Fz7ltEYtS6JngsR7ISLzf9bJiIoaX3kSa2dHgQ3HQ5EM47UT b2Z1eepX9YUOjaMQkv6dwT534mVHV9hgjcjZEeFNnueNDcnPYCFqdiTfuDd8oUGcTlL3na srhGv/EhOpVGariGfw9XUlMY8CBWS1ZLGXRG68+eljEI0xXfs1NBtybL14GQuA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1682285498; a=rsa-sha256; cv=none; b=x61MawjnO+ZG5kgVFpUgun38kBRGGVbSR8qFicI4ZV9AYcsL9QkfdZrckI488iaxRLMMck H0RGWG7oog0bL8TA6up4EjjPwKirgc0luBcvWHiTO0LZMGRHmRqwBln248/QIwSr6a0pCK qk1LsGdSIjooipCZwwSbt4YTY9h3wtyAvrBYpKgqgS5tTILuWJ5hvBY3baax0SN18MHHNm wChHUk/zGxj7gdyUfIkRRL6O3KS7jnvSi5Slhdoq+i+yJ4davkD6yOo8JZP1WHzbB8cxCE eVFFnh4TGaChk3t+6+0ShCb/qjzfpQZ6D2YfMqTdWKYfZeO2vS9ceYtlv7TZig== 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 4Q4M0975Zwz10QK; Sun, 23 Apr 2023 21:31:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 33NLVbv6084503; Sun, 23 Apr 2023 21:31:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 33NLVbn2084502; Sun, 23 Apr 2023 21:31:37 GMT (envelope-from git) Date: Sun, 23 Apr 2023 21:31:37 GMT Message-Id: <202304232131.33NLVbn2084502@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 3c4ba5f55438 - main - mt76: add module build framework and man pages List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6 commit 3c4ba5f55438f7afd4f4b0b56f88f2bb505fd6a6 Author: Bjoern A. Zeeb AuthorDate: 2023-04-18 14:30:20 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-04-23 21:31:07 +0000 mt76: add module build framework and man pages Add framework to build if_mt7915 and if_mt7921 with LinuxKPI as well as initial man pages for the two mt76 chipset drivers. MFC after: 2 months --- share/man/man4/mt7915.4 | 100 +++++++++++++++++++++++++++++++++++++++ share/man/man4/mt7921.4 | 100 +++++++++++++++++++++++++++++++++++++++ sys/modules/mt76/Makefile | 7 +++ sys/modules/mt76/Makefile.inc | 30 ++++++++++++ sys/modules/mt76/core/Makefile | 26 ++++++++++ sys/modules/mt76/mt7915/Makefile | 24 ++++++++++ sys/modules/mt76/mt7921/Makefile | 30 ++++++++++++ 7 files changed, 317 insertions(+) diff --git a/share/man/man4/mt7915.4 b/share/man/man4/mt7915.4 new file mode 100644 index 000000000000..0bb82959d488 --- /dev/null +++ b/share/man/man4/mt7915.4 @@ -0,0 +1,100 @@ +.\"- +.\" Copyright (c) 2023 Bjoern A. Zeeb +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2023 +.Dt MT7915 4 +.Os +.Sh NAME +.Nm mt7915 +.Nd MediaTek IEEE 802.11ax wireless network driver +.Sh SYNOPSIS +The driver will auto-load without any user interaction using +.Xr devmatch 8 +if enabled in +.Xr rc.conf 5 . +.Pp +Only if auto-loading is explicitly disabled, place the following +lines in +.Xr rc.conf 5 +to manually load the driver as a module at boot time: +.Bd -literal -offset indent +kld_list="${kld_list} if_mt7915" +.Ed +.Pp +The driver should automatically load any +firmware needed for the particular chipset. +.Pp +It is discouraged to load the driver from +.Xr loader 8 . +.Sh DESCRIPTION +The +.Nm +driver is derived from MediaTek's Linux mt76 driver and provides support for +the following chipsets: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It MediaTek MT7915E (PCIe) +.El +.Pp +This driver requires firmware to be loaded before it will work. +The package +.Pa wifi-firmware-mt76-kmod +from the +.Pa ports/net/wifi-firmware-mt76-kmod +port needs to be installed before the driver is loaded. +Otherwise no +.Xr wlan 4 +interface can be created using +.Xr ifconfig 8 . +.Pp +The driver uses the +.\" No LinuxKPI man pages so no .Xr here. +.Em linuxkpi_wlan +and +.Em linuxkpi +compat framework to bridge between the Linux and +native +.Fx +driver code as well as to the native +.Xr net80211 4 +wireless stack. +.Pp +While +.Nm +supports all 802.11 a/b/g/n/ac and ax +the compatibility code currently only supports 802.11 a/b/g modes. +Support for 802.11 n/ac is to come. +.Sh BUGS +Certainly. +.Sh SEE ALSO +.Xr wlan 4 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 14.0 . diff --git a/share/man/man4/mt7921.4 b/share/man/man4/mt7921.4 new file mode 100644 index 000000000000..3cafa52779dd --- /dev/null +++ b/share/man/man4/mt7921.4 @@ -0,0 +1,100 @@ +.\"- +.\" Copyright (c) 2023 Bjoern A. Zeeb +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 18, 2023 +.Dt MT7921 4 +.Os +.Sh NAME +.Nm mt7921 +.Nd MediaTek IEEE 802.11ax wireless network driver +.Sh SYNOPSIS +The driver will auto-load without any user interaction using +.Xr devmatch 8 +if enabled in +.Xr rc.conf 5 . +.Pp +Only if auto-loading is explicitly disabled, place the following +lines in +.Xr rc.conf 5 +to manually load the driver as a module at boot time: +.Bd -literal -offset indent +kld_list="${kld_list} if_mt7921" +.Ed +.Pp +The driver should automatically load any +firmware needed for the particular chipset. +.Pp +It is discouraged to load the driver from +.Xr loader 8 . +.Sh DESCRIPTION +The +.Nm +driver is derived from MediaTek's Linux mt76 driver and provides support for +the following chipsets: +.Pp +.Bl -tag -width Ds -offset indent -compact +.It MediaTek MT7921E (PCIe) +.El +.Pp +This driver requires firmware to be loaded before it will work. +The package +.Pa wifi-firmware-mt76-kmod +from the +.Pa ports/net/wifi-firmware-mt76-kmod +port needs to be installed before the driver is loaded. +Otherwise no +.Xr wlan 4 +interface can be created using +.Xr ifconfig 8 . +.Pp +The driver uses the +.\" No LinuxKPI man pages so no .Xr here. +.Em linuxkpi_wlan +and +.Em linuxkpi +compat framework to bridge between the Linux and +native +.Fx +driver code as well as to the native +.Xr net80211 4 +wireless stack. +.Pp +While +.Nm +supports all 802.11 a/b/g/n/ac and ax +the compatibility code currently only supports 802.11 a/b/g modes. +Support for 802.11 n/ac is to come. +.Sh BUGS +Certainly. +.Sh SEE ALSO +.Xr wlan 4 , +.Xr ifconfig 8 , +.Xr wpa_supplicant 8 +.Sh HISTORY +The +.Nm +driver first appeared in +.Fx 14.0 . diff --git a/sys/modules/mt76/Makefile b/sys/modules/mt76/Makefile new file mode 100644 index 000000000000..013219337952 --- /dev/null +++ b/sys/modules/mt76/Makefile @@ -0,0 +1,7 @@ +# $FreeBSD$ + +SUBDIR= core +SUBDIR+= mt7915 +SUBDIR+= mt7921 + +.include diff --git a/sys/modules/mt76/Makefile.inc b/sys/modules/mt76/Makefile.inc new file mode 100644 index 000000000000..5e3e05dab59c --- /dev/null +++ b/sys/modules/mt76/Makefile.inc @@ -0,0 +1,30 @@ +# $FreeBSD$ + +# Common information shared by all submodule builds. + +COMMONDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76 + +.PATH: ${COMMONDIR} + +WITH_CONFIG_PM= 0 +WITH_DEBUGFS= 0 + +# Other +SRCS+= ${LINUXKPI_GENSRCS} +SRCS+= opt_wlan.h opt_inet6.h opt_inet.h + +# Helpful after fresh imports. +#CFLAGS+= -ferror-limit=0 + +.if defined(WITH_CONFIG_PM) && ${WITH_CONFIG_PM} > 0 +CFLAGS+= -DCONFIG_PM=${WITH_CONFIG_PM} +.endif + +.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 +CFLAGS+= -DCONFIG_MAC80211_DEBUGFS=${WITH_DEBUGFS} +.endif + +CFLAGS+= -I${COMMONDIR} +CFLAGS+= ${LINUXKPI_INCLUDES} + +# end diff --git a/sys/modules/mt76/core/Makefile b/sys/modules/mt76/core/Makefile new file mode 100644 index 000000000000..52f5c1b20284 --- /dev/null +++ b/sys/modules/mt76/core/Makefile @@ -0,0 +1,26 @@ +# $FreeBSD$ + +KMOD= mt76_core + +# Basic stuff. +SRCS= mac80211.c mmio.c util.c dma.c eeprom.c tx.c agg-rx.c mcu.c +#SRCS+= trace.c + +# Bus stuff. +SRCS+= pci.c +#SRCS+= usb.c # usb_trace.c +#SRCS+= sdio.c sdio_txrx.c + +# Connac-Lib stuff. +SRCS+= mt76_connac_mac.c mt76_connac_mcu.c + +# MT76x02-Lib stuff (we don't need; that's for older chipsets not yet supported) + +.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 +SRCS+= debugfs.c +.endif + +CFLAGS+= -DKBUILD_MODNAME='"mt76_core"' +CFLAGS+= -DCONFIG_MAC80211_DEBUGFS=${WITH_DEBUGFS} + +.include diff --git a/sys/modules/mt76/mt7915/Makefile b/sys/modules/mt76/mt7915/Makefile new file mode 100644 index 000000000000..d4bc68d53782 --- /dev/null +++ b/sys/modules/mt76/mt7915/Makefile @@ -0,0 +1,24 @@ +# $FreeBSD$ + +DEVDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76/mt7915 + +.PATH: ${DEVDIR} + +KMOD= if_mt7915 + +# Common stuff. +SRCS= init.c main.c mac.c mcu.c mmio.c eeprom.c +SRCS+= pci.c dma.c + +# SOC+6E stuff. +#SRCS+= soc.c + +.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 +SRCS+= debugfs.c +CFLAGS+= -DCONFIG_MT7915_DEBUGFS=${WITH_DEBUGFS} +.endif + +CFLAGS+= -DKBUILD_MODNAME='"mt7915"' +CFLAGS+= -I${DEVDIR} + +.include diff --git a/sys/modules/mt76/mt7921/Makefile b/sys/modules/mt76/mt7921/Makefile new file mode 100644 index 000000000000..25d5ef8e9da5 --- /dev/null +++ b/sys/modules/mt76/mt7921/Makefile @@ -0,0 +1,30 @@ +# $FreeBSD$ + +DEVDIR= ${SRCTOP}/sys/contrib/dev/mediatek/mt76/mt7921 + +.PATH: ${DEVDIR} + +KMOD= if_mt7921 + +# Common stuff. +SRCS= init.c main.c mac.c mcu.c +#SRCS+= trace.c + +# PCI stuff. +SRCS+= pci.c pci_mac.c pci_mcu.c dma.c + +# USB stuff. +#SRCS+= usb.c usb_mac.c + +# SDIO stuff. +#SRCS+= sdio.c sdio_mac.c sdio_mcu.c + +.if defined(WITH_DEBUGFS) && ${WITH_DEBUGFS} > 0 +SRCS+= debugfs.c +CFLAGS+= -DCONFIG_MT7921_DEBUGFS=${WITH_DEBUGFS} +.endif + +CFLAGS+= -DKBUILD_MODNAME='"mt7921"' +CFLAGS+= -I${DEVDIR} + +.include