So, there is actually another bug in that chunk of code. This diff fixes them:
- Read the register from the correct location: HCSPARAMS is a capability register. - Construct the resulting mask correctly by adding parenthesis where needed: '|' takes precedence over '?' so currently the expression evaluates as EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PORT_IND where v is not even the correct value. This should let the ehci driver correctly report the characteristics of the controller's root hub. Index: ehci.c =================================================================== RCS file: /cvs/src/sys/dev/usb/ehci.c,v retrieving revision 1.117 diff -u -r1.117 ehci.c --- ehci.c 3 Jul 2011 15:47:17 -0000 1.117 +++ ehci.c 9 Jul 2011 00:52:49 -0000 @@ -2148,11 +2148,10 @@ } hubd = ehci_hubd; hubd.bNbrPorts = sc->sc_noport; - v = EOREAD4(sc, EHCI_HCSPARAMS); + v = EREAD4(sc, EHCI_HCSPARAMS); USETW(hubd.wHubCharacteristics, - EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH | - EHCI_HCS_P_INDICATOR(EREAD4(sc, EHCI_HCSPARAMS)) - ? UHD_PORT_IND : 0); + (EHCI_HCS_PPC(v) ? UHD_PWR_INDIVIDUAL : UHD_PWR_NO_SWITCH) | + (EHCI_HCS_P_INDICATOR(v) ? UHD_PORT_IND : 0)); hubd.bPwrOn2PwrGood = 200; /* XXX can't find out? */ for (i = 0, l = sc->sc_noport; l > 0; i++, l -= 8, v >>= 8) hubd.DeviceRemovable[i++] = 0; /* XXX can't find out? */