Plan 9 from Bell Labs’s /sources/contrib/mospak/9-portusbehci-route/README

Copyright © 2026 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


9-portusbehci-route: ports of a second EHCI stay at full speed

init in sys/src/9/port/usbehci.c sets the Configure Flag only on
the first EHCI controller it starts:

    opio->config = (ctlrno == 0? Callmine: 0);

EHCI 1.0 sections 2.3.8 and 4.2: each EHCI has its own CONFIGFLAG,
which routes that controller's own ports, and only those, between
it and its companion controllers.  With 0, every port of a second
EHCI stays with its UHCI or OHCI companions, so a USB 2 device
there runs at full speed (12 Mb/s).

The fix restores the line init had until the 2011-07-27 Bell Labs
sources, which sets the flag on every controller:

    opio->config = Callmine;	/* reclaim all ports */

and drops the counter and comment that went with the change.
init is again the Bell Labs code of 2011-04-23.

The 2011 change was made for a machine that hung when its second EHCI
was given its ports.  At the time the BIOS handoff in
usbehcipc.c (getehci) could not find the legacy support
capability (Ceecpmask was 8); the same 2011-07-27 sources fixed
it, so each controller is taken from the BIOS in ehcireset before
init sets its flag.  A machine that still hangs can leave all but
the first EHCI alone with *maxehci=1 in plan9.ini, unchanged by
this patch.

The pc, kw, omap and teg2 kernels share this code; with one
EHCI nothing changes.

Apply
    cd /
    ape/patch -p0 < /path/to/9-portusbehci-route/9-portusbehci-route.diff

Rebuild
    cd /sys/src/9/pc && mk 'CONF=pccpuf' install

    Use the kernel directory and CONF you boot.

Verification
    Attach a USB 2 device to a port of the second EHCI and boot.

    Before: it shows up in /dev/usb/ctl as speed full, on uhci
    or ohci.
    After: speed high, on ehci.

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2026 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.