Files
RedBear-OS/drivers/usb
Red Bear OS d20557f726 xhcid: gate xHCI 1.1+ features on HCCPARAMS2 + protocol-caps bits (P2-B)
Gate xHCI 1.1+ features on their capability bits, cross-referenced with
Linux 7.1 xhci driver behavior:

LEC (HCC2_LEC, scheme.rs):
- lec now uses Linux xhci-mem.c:1350 exact condition:
  hci_version > 0x100 && hcc_params2 & HCC2_LEC (HCCPARAMS2 register
  space is reserved on 1.0 controllers).
- Max ESIT Payload Hi zeroed when LEC=0 (spec Table 6-8 RsvdZ).

U3C (HCC2_U3C, mod.rs suspend_port):
- Refuse SuperSpeed U3 entry with ENOSYS when hci_ver >= 0x110 and
  HCC2_U3C=0 (spec 4.15.1). USB2 suspend unaffected. Linux 7.1 defines
  but never gates this bit; xhcid follows the spec.

CIC (HCC2_CIC): CIE gate pre-existing (set_cie from cic()); added the
hci_ver > 0x100 version guard. HCC2 capability log block similarly
guarded.

HW LPM (extended.rs, mod.rs, port.rs):
- New SupportedProtoCap::{l1_capable,hw_lpm_capable,besl_lpm_capable}
  reading protocol-defined bits (Linux xhci-ext-caps.h:62-66 L1C/HLC/BLC).
- Xhci::hw_lpm_support computed per Linux xhci-mem.c:2137:
  hci_ver >= 0x100 && !HW_LPM_DISABLE && any USB2 protocol cap has HLC.
- attach_device(): defensive LPM clear on USB 2.0 protocol ports
  (rev_major() != 3) when hw_lpm_support is false — Linux xhci.c:4725
  disable path; USB3 excluded because PORTPMSC L1DS aliases U2 timeout.
- Port::enable_lpm/disable_lpm register targets fixed: HLE/HIRD/RWE/
  L1DS belong in PORTPMSC (offset 0x04), not PORTHLPMC (0x0C, bit 16
  RsvdZ) — spec Tables 5-21/5-23, Linux xhci-port.h:135-158. Helpers
  rewritten to Linux xhci.c:4686-4737 two-register sequence.
- Per-device L1 enablement (BESL, MEL Evaluate Context) defers to P3.

Bug fix: removed bogus CapabilityRegs::hlc() + HCC_PARAMS1_HLC_BIT —
they read xECP pointer bits 16-31 of HCCPARAMS1 (spec Table 5-13), not
HLC. HLC lives in the Supported Protocol capability port_info DWORD.

Verification: cargo check clean (138 warnings, -2 vs baseline: the new
disable_lpm call site also revived PORT_HLE/PORT_HIRD_MASK), 43/43
tests pass.
2026-07-18 22:33:38 +09:00
..
2026-03-22 09:45:09 +00:00