Work in progress on USB rtw88 and rtw89 drivers

From: John F Carr <jfc_at_MIT.EDU>
Date: Thu, 25 Jun 2026 00:13:03 UTC
I am taking a break from my project to get the USB rtw88 and
rtw89 drivers to work.  This is taking too much time for now.
If anybody wants to take a look at the incomplete project or
pick up the work, it's on GitHub.  See branches jfc/kpi15 and
jfc/kpi16 at https://github.com/VoxSciurorum/freebsd-src,
based on stable/15 and main.

This is what the kernel has to say when I load my if_rtw88 module:

usb_linux0 on uhub0
usb_linux0: <Realtek USB3.0 802.11ac 1200M Adapter, class 0/0, rev 2.10/2.10, addr 1> on usbus0
linuxkpi: Using chanctx emulation.
usb_linux0: successfully loaded firmware image 'rtw88/rtw8822b_fw.bin'
usb_linux0: Firmware version 30.20.0, H2C version 14
usb_linux0: error beacon valid
usb_linux0: failed to download rsvd page
usb_linux0: failed to download firmware
usb_linux0: failed to setup chip efuse info
usb_linux0: failed to setup chip information
device_attach: usb_linux0 attach returned 6

I suspect that the "error beacon valid" message marks the
first time the driver inspects data read from the device.
Maybe data transfer just doesn't work.  I have
compat.linuxkpi.skb.mem_limit=1 as the man page suggests
because my test system has 16 GB of memory.

The changes are

1. (KPI) Implement some endpoint accessors like usb_endpoint_xfer_bulk.
   I extracted this to commit db7000e843 on branch jfc/endpoint
   in git@github.com:VoxSciurorum/freebsd-src.  GitHub does not
   offer me a button to open a pull request.

2. (KPI) Implement the usb_anchor_urb family.  This adds a reference
   count to a data structure that used to be explicitly freed.
   These functions may be untested.  At least the code compiles.

3. (KPI) Otherwise expand the Linux KPI USB code to provide what the
   rtw drivers expect.  BSD and Linux code now use distinct
   struct usb_interface types.

4. (rtw88) Changes to the driver to get as far as the dmesg
   output above.

5. (rtw89) Changes to the driver to compile and load.

The functions I added in items (1) and (2) have been in the
Linux kernel since c. 2007.  See Linux kernel commit 51a2f077.

John Carr