HomeFreeBSD

xhci: Refactor xhci_generic_setup code

Description

xhci: Refactor xhci_generic_setup code

Our USB TRB buildup subroutines were previously difficult to follow. In
setup_generic_chain_sub(), the routine filled TRB packets based on the
characteristics passed by the caller and the current state (for example,
whether the TRB was the last in the TD).

However, most TRB types (except Normal TRBs) cannot be shared across TDs.
To simplify the logic, refactor xhci_setup_generic() so that TRBs are
constructed according to their transfer type, with dedicated helper
functions for each TRB type.

Sponsored by: The FreeBSD Foundation
Assisted-by: Claude Code (Opus 4.6, Opus 4.8(1M) and Sonet 5.0)
Differential Revision: https://reviews.freebsd.org/D57130

Details

Provenance
aokblastAuthored on May 20 2026, 9:26 AM
Differential Revision
D57130: xhci: Refactor xhci_setup_generic code
Parents
rGa594783bac90: linux_firmware: reformat error print-out
Branches
Unknown
Tags
Unknown