Skip to content

Support MT7922 in PCIe form (14c3:0616, AMD RZ616) - #3

Open
e5u wants to merge 1 commit into
flxxxxddd:mt7921-fixesfrom
e5u:mt7922-pcie-0616
Open

e5u wants to merge 1 commit into
flxxxxddd:mt7921-fixesfrom
e5u:mt7922-pcie-0616

Conversation

@e5u

@e5u e5u commented Oct 20, 2026

Copy link
Copy Markdown

症状

MT7922 以 PCIe 形式(AMD RZ616,14c3:0616)出现时,驱动不认卡:

probe vendor=0x14c3 product=0x0616 matched=0     # mwx_match() 直接丢掉

只有 AirportMtkWlan/WCL/Info.plist 的 IOPCIPrimaryMatch 列了 0x061614c3,
而 HAL 这一侧停在了 14c3:7922。

原因

仓库里两处设备表都没有 0x0616:

  • SimpleMtkWlan/Info.plist → IOPCIPrimaryMatch = 0x796114c3 0x060814c3 0x792214c3
  • SimpleMtkWlan/hal_mwx/MtkMwx.cpp:339 → mwx_devices[] 只有 0x7961 / 0x0608 / 0x7922

于是 mwx_match()(MtkMwx.cpp:7228,pci_matchbyid(vendor, product, mwx_devices, …))返回 false,卡根本进不了 attach。
即使绕过这层,MtkMwx.cpp:2273 也只判 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_MEDIATEK_MT7922,
其他一律落到 MWX_HW_MT7921 → 加载 MT7961 的 ROM patch / firmware,不是 MT7922 的那套。

0x7922 是芯片内部的 dev id,0x0616 是同一个 MT7922 在 PCIe 端点上报的 device id,两者都应当映射到
MWX_HW_MT7922。

改动

  • SimpleMtkWlan/Info.plist:IOPCIPrimaryMatch 增加 0x061614c3
  • SimpleMtkWlan/hal_mwx/MtkMwx.cpp:
    • 新增 #define PCI_PRODUCT_MEDIATEK_MT7922_PCIE 0x0616
    • mwx_devices[] 增加对应条目
    • mwx_attach() 的硬件类型判断同时接受 0x0616 和 0x7922

原来的 14c3:7922 行为不变。

验证

  • 在 Ryzen 9 9955HX + RTX 5060 Laptop 的黑苹果上,macOS 15.6 (24G84),
    网卡 14c3:0616:1.5.0 的二进制在这两处(HAL 设备表、hwtype 比较常量)手工改成 0x0616 后,
    驱动正常 attach(attach hardware type=MT7922),加载 mwx-mt7922_* 固件,
    连上 5 GHz 80 MHz 的 AP,速率 867 Mbps,睡眠/唤醒正常。
  • 本次改动就是把那两处二进制补丁写回源码,另加 Info.plist 的 PCI 匹配串。
  • plutil -lint 通过;手边没有 Xcode(只有 Command Line Tools),所以没有在这里跑 build-macos.sh。

The MT7922 reports the internal chip id 0x7922, but the same chip as a PCIe
endpoint enumerates as 14c3:0616 (AMD RZ616). Only the AirportMtkWlan wrapper
listed 0x061614c3, so the HAL never probed the card: SimpleMtkWlan's
IOPCIPrimaryMatch and mwx_devices[] both stopped at 14c3:7922, and mwx_attach()
classified anything else as MWX_HW_MT7921, which loads the MT7961 ROM patch and
firmware instead of the MT7922 pair.

- Info.plist: add 0x061614c3 to IOPCIPrimaryMatch
- MtkMwx: add PCI_PRODUCT_MEDIATEK_MT7922_PCIE, match it in mwx_devices[] and
  map it to MWX_HW_MT7922 in mwx_attach()

Existing 14c3:7922 behaviour is unchanged.

Verified on a 14c3:0616 card on macOS 15.6: these two spots were binary patched
in 1.5.0 to make the card attach as MT7922; this commit puts the same two
changes in the source, plus the missing PCI match string.
Copilot AI balanced review requested due to automatic review settings October 20, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants