Skip to content

usb: separate generic USB layer from xHCI implementation (prepare for non-xHCI controllers) #6

@emilf

Description

@emilf

Today kernel/src/drivers/usb/mod.rs is mostly a thin re-export layer around the xHCI driver (e.g. service_runtime_interrupt, kick_msix_self_test, diagnostics APIs). The interrupt handler handler_usb_xhci calls into crate::drivers::usb::service_runtime_interrupt(), which currently just forwards to xHCI.

This makes it hard to support other host controller types (EHCI/OHCI/UHCI, or future controllers) and also complicates running under hypervisors/firmware setups that may expose older controllers by default.

Proposal:

  • Introduce a generic USB host-controller abstraction layer (HCD trait) and a USB core module that owns higher-level runtime servicing APIs.
  • xHCI becomes one HCD implementation; other controllers can be added later or stubbed.
  • Move xHCI-specific diagnostics/self-tests under an xHCI namespace; keep generic hooks in drivers::usb.

Acceptance:

  • drivers::usb provides controller-agnostic init + runtime servicing hooks.
  • Interrupt handlers call into the generic USB layer, which dispatches to registered HCDs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions