Changeset View
Changeset View
Standalone View
Standalone View
head/sys/dev/usb/controller/xhci_pci.c
Show First 20 Lines • Show All 57 Lines • ▼ Show 20 Lines | |||||
#include <dev/usb/usb_controller.h> | #include <dev/usb/usb_controller.h> | ||||
#include <dev/usb/usb_bus.h> | #include <dev/usb/usb_bus.h> | ||||
#include <dev/usb/usb_pci.h> | #include <dev/usb/usb_pci.h> | ||||
#include <dev/usb/controller/xhci.h> | #include <dev/usb/controller/xhci.h> | ||||
#include <dev/usb/controller/xhcireg.h> | #include <dev/usb/controller/xhcireg.h> | ||||
#include "usb_if.h" | #include "usb_if.h" | ||||
static device_probe_t xhci_pci_probe; | static device_probe_t xhci_pci_probe; | ||||
static device_attach_t xhci_pci_attach; | |||||
static device_detach_t xhci_pci_detach; | static device_detach_t xhci_pci_detach; | ||||
static usb_take_controller_t xhci_pci_take_controller; | static usb_take_controller_t xhci_pci_take_controller; | ||||
static device_method_t xhci_device_methods[] = { | static device_method_t xhci_device_methods[] = { | ||||
/* device interface */ | /* device interface */ | ||||
DEVMETHOD(device_probe, xhci_pci_probe), | DEVMETHOD(device_probe, xhci_pci_probe), | ||||
DEVMETHOD(device_attach, xhci_pci_attach), | DEVMETHOD(device_attach, xhci_pci_attach), | ||||
DEVMETHOD(device_detach, xhci_pci_detach), | DEVMETHOD(device_detach, xhci_pci_detach), | ||||
DEVMETHOD(device_suspend, bus_generic_suspend), | DEVMETHOD(device_suspend, bus_generic_suspend), | ||||
DEVMETHOD(device_resume, bus_generic_resume), | DEVMETHOD(device_resume, bus_generic_resume), | ||||
DEVMETHOD(device_shutdown, bus_generic_shutdown), | DEVMETHOD(device_shutdown, bus_generic_shutdown), | ||||
DEVMETHOD(usb_take_controller, xhci_pci_take_controller), | DEVMETHOD(usb_take_controller, xhci_pci_take_controller), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t xhci_driver = { | DEFINE_CLASS_0(xhci, xhci_pci_driver, xhci_device_methods, | ||||
.name = "xhci", | sizeof(struct xhci_softc)); | ||||
.methods = xhci_device_methods, | |||||
.size = sizeof(struct xhci_softc), | |||||
}; | |||||
static devclass_t xhci_devclass; | static devclass_t xhci_devclass; | ||||
DRIVER_MODULE(xhci, pci, xhci_driver, xhci_devclass, NULL, NULL); | DRIVER_MODULE(xhci, pci, xhci_pci_driver, xhci_devclass, NULL, NULL); | ||||
MODULE_DEPEND(xhci, usb, 1, 1, 1); | MODULE_DEPEND(xhci, usb, 1, 1, 1); | ||||
static const char * | static const char * | ||||
xhci_pci_match(device_t self) | xhci_pci_match(device_t self) | ||||
{ | { | ||||
uint32_t device_id = pci_get_devid(self); | uint32_t device_id = pci_get_devid(self); | ||||
switch (device_id) { | switch (device_id) { | ||||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | xhci_pci_port_route(device_t self, uint32_t set, uint32_t clear) | ||||
pci_write_config(self, PCI_XHCI_INTEL_USB3_PSSEN, temp & usb3_mask, 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); | pci_write_config(self, PCI_XHCI_INTEL_XUSB2PR, temp & usb2_mask, 4); | ||||
device_printf(self, "Port routing mask set to 0x%08x\n", temp); | device_printf(self, "Port routing mask set to 0x%08x\n", temp); | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | int | ||||
xhci_pci_attach(device_t self) | xhci_pci_attach(device_t self) | ||||
{ | { | ||||
struct xhci_softc *sc = device_get_softc(self); | struct xhci_softc *sc = device_get_softc(self); | ||||
int count, err, msix_table, rid; | int count, err, msix_table, rid; | ||||
uint8_t usemsi = 1; | uint8_t usemsi = 1; | ||||
uint8_t usedma32 = 0; | uint8_t usedma32 = 0; | ||||
rid = PCI_XHCI_CBMEM; | rid = PCI_XHCI_CBMEM; | ||||
▲ Show 20 Lines • Show All 221 Lines • Show Last 20 Lines |