Index: sys/dev/usb/controller/xhci_pci.c =================================================================== --- sys/dev/usb/controller/xhci_pci.c (revision 313456) +++ sys/dev/usb/controller/xhci_pci.c (working copy) @@ -174,13 +174,21 @@ static int xhci_pci_port_route(device_t self, uint32_t set, uint32_t clear) { uint32_t temp; + uint32_t temp_pssen, temp_xusb2pr; uint32_t usb3_mask; uint32_t usb2_mask; - temp = pci_read_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 4) | - pci_read_config(self, PCI_XHCI_INTEL_XUSB2PR, 4); + temp_pssen = pci_read_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 4); + temp_xusb2pr = pci_read_config(self, PCI_XHCI_INTEL_XUSB2PR, 4); - temp |= set; +#ifdef USB_DEBUG + device_printf(self, "USB Ports w/ enabled SuperSpeed: 0x%08x\n", + temp_pssen); + device_printf(self, "USB 2.0 Ports handed over to xHCI: 0x%08x\n", + temp_xusb2pr); +#endif + + temp = temp_pssen | temp_xusb2pr | set; temp &= ~clear; /* Don't set bits which the hardware doesn't support */ @@ -187,11 +195,24 @@ xhci_pci_port_route(device_t self, uint32_t set, u usb3_mask = pci_read_config(self, PCI_XHCI_INTEL_USB3PRM, 4); usb2_mask = pci_read_config(self, PCI_XHCI_INTEL_USB2PRM, 4); - pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp & usb3_mask, 4); - pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp & usb2_mask, 4); +#ifdef USB_DEBUG + device_printf(self, "Ports to enable SuperSpeed: 0x%08x\n", usb3_mask); + device_printf(self, "Ports to hand over to xHCI: 0x%08x\n", usb2_mask); +#endif - device_printf(self, "Port routing mask set to 0x%08x\n", temp); + pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp & (usb3_mask | + temp_pssen), 4); + pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp & (usb2_mask | + temp_xusb2pr), 4); + usb3_mask = pci_read_config(self, PCI_XHCI_INTEL_USB3_PSSEN, 4); + usb2_mask = pci_read_config(self, PCI_XHCI_INTEL_XUSB2PR, 4); + + device_printf(self, "USB 3.0 ports that are now enabled under xHCI:" + "0x%08x\n", usb3_mask); + device_printf(self, "USB 2.0 ports that are now switched over to xHCI:" + "0x%08x\n", usb2_mask); + return (0); }