Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/ohci_pci.c
Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | |||||
#define PCI_OHCI_BASE_REG 0x10 | #define PCI_OHCI_BASE_REG 0x10 | ||||
static device_probe_t ohci_pci_probe; | static device_probe_t ohci_pci_probe; | ||||
static device_attach_t ohci_pci_attach; | static device_attach_t ohci_pci_attach; | ||||
static device_detach_t ohci_pci_detach; | static device_detach_t ohci_pci_detach; | ||||
static usb_take_controller_t ohci_pci_take_controller; | static usb_take_controller_t ohci_pci_take_controller; | ||||
static pci_device_table ohci_devs[] = { | |||||
{PCI_DEVID(0x523710b9), | |||||
PCI_DESCR("AcerLabs M5237 (Aladdin-V) USB controller")}, | |||||
{PCI_DEVID(0x740c1022), | |||||
PCI_DESCR("AMD-756 USB Controller")}, | |||||
{PCI_DEVID(0x74141022), | |||||
PCI_DESCR("AMD-766 USB Controller")}, | |||||
{PCI_DEVID(0x78071022), | |||||
PCI_DESCR("AMD FCH USB Controller")}, | |||||
{PCI_DEVID(0x43741002), | |||||
PCI_DESCR("ATI SB400 USB Controller")}, | |||||
{PCI_DEVID(0x43751002), | |||||
PCI_DESCR("ATI SB400 USB Controller")}, | |||||
{PCI_DEVID(0x43971002), | |||||
PCI_DESCR("AMD SB7x0/SB8x0/SB9x0 USB controller")}, | |||||
{PCI_DEVID(0x43981002), | |||||
PCI_DESCR("AMD SB7x0/SB8x0/SB9x0 USB controller")}, | |||||
{PCI_DEVID(0x43991002), | |||||
PCI_DESCR("AMD SB7x0/SB8x0/SB9x0 USB controller")}, | |||||
{PCI_DEVID(0x06701095), | |||||
PCI_DESCR("CMD Tech 670 (USB0670) USB controller")}, | |||||
{PCI_DEVID(0x06731095), | |||||
PCI_DESCR("CMD Tech 673 (USB0673) USB controller")}, | |||||
{PCI_DEVID(0xc8611045), | |||||
PCI_DESCR("OPTi 82C861 (FireLink) USB controller")}, | |||||
{PCI_DEVID(0x00351033), | |||||
PCI_DESCR("NEC uPD 9210 USB controller")}, | |||||
{PCI_DEVID(0x00d710de), | |||||
PCI_DESCR("nVidia nForce3 USB Controller")}, | |||||
{PCI_DEVID(0x005a10de), | |||||
PCI_DESCR("nVidia nForce CK804 USB Controller")}, | |||||
{PCI_DEVID(0x036c10de), | |||||
PCI_DESCR("nVidia nForce MCP55 USB Controller")}, | |||||
{PCI_DEVID(0x03f110de), | |||||
PCI_DESCR("nVidia nForce MCP61 USB Controller")}, | |||||
{PCI_DEVID(0x0aa510de), | |||||
PCI_DESCR("nVidia nForce MCP79 USB Controller")}, | |||||
{PCI_DEVID(0x0aa710de), | |||||
PCI_DESCR("nVidia nForce MCP79 USB Controller")}, | |||||
{PCI_DEVID(0x0aa810de), | |||||
PCI_DESCR("nVidia nForce MCP79 USB Controller")}, | |||||
{PCI_DEVID(0x70011039), | |||||
PCI_DESCR("SiS 5571 USB controller")}, | |||||
{PCI_DEVID(0x1103108e), | |||||
PCI_DESCR("Sun PCIO-2 USB controller")}, | |||||
{PCI_DEVID(0x0019106b), | |||||
PCI_DESCR("Apple KeyLargo USB controller")}, | |||||
{PCI_DEVID(0x003f106b), | |||||
PCI_DESCR("Apple KeyLargo/Intrepid USB controller")} | |||||
}; | |||||
static int | static int | ||||
ohci_pci_take_controller(device_t self) | ohci_pci_take_controller(device_t self) | ||||
{ | { | ||||
uint32_t reg; | uint32_t reg; | ||||
uint32_t int_line; | uint32_t int_line; | ||||
if (pci_get_powerstate(self) != PCI_POWERSTATE_D0) { | if (pci_get_powerstate(self) != PCI_POWERSTATE_D0) { | ||||
device_printf(self, "chip is in D%d mode " | device_printf(self, "chip is in D%d mode " | ||||
"-- setting to D0\n", pci_get_powerstate(self)); | "-- setting to D0\n", pci_get_powerstate(self)); | ||||
reg = pci_read_config(self, PCI_CBMEM, 4); | reg = pci_read_config(self, PCI_CBMEM, 4); | ||||
int_line = pci_read_config(self, PCIR_INTLINE, 4); | int_line = pci_read_config(self, PCIR_INTLINE, 4); | ||||
pci_set_powerstate(self, PCI_POWERSTATE_D0); | pci_set_powerstate(self, PCI_POWERSTATE_D0); | ||||
pci_write_config(self, PCI_CBMEM, reg, 4); | pci_write_config(self, PCI_CBMEM, reg, 4); | ||||
pci_write_config(self, PCIR_INTLINE, int_line, 4); | pci_write_config(self, PCIR_INTLINE, int_line, 4); | ||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static const char * | static const char * | ||||
ohci_pci_match(device_t self) | ohci_pci_match(device_t self) | ||||
{ | { | ||||
uint32_t device_id = pci_get_devid(self); | const struct pci_device_table *ohcid; | ||||
switch (device_id) { | ohcid = PCI_MATCH(self, ohci_devs); | ||||
case 0x523710b9: | if (ohcid == NULL) { | ||||
return ("AcerLabs M5237 (Aladdin-V) USB controller"); | |||||
case 0x740c1022: | |||||
return ("AMD-756 USB Controller"); | |||||
case 0x74141022: | |||||
return ("AMD-766 USB Controller"); | |||||
case 0x78071022: | |||||
return ("AMD FCH USB Controller"); | |||||
case 0x43741002: | |||||
return "ATI SB400 USB Controller"; | |||||
case 0x43751002: | |||||
return "ATI SB400 USB Controller"; | |||||
case 0x43971002: | |||||
return ("AMD SB7x0/SB8x0/SB9x0 USB controller"); | |||||
case 0x43981002: | |||||
return ("AMD SB7x0/SB8x0/SB9x0 USB controller"); | |||||
case 0x43991002: | |||||
return ("AMD SB7x0/SB8x0/SB9x0 USB controller"); | |||||
case 0x06701095: | |||||
return ("CMD Tech 670 (USB0670) USB controller"); | |||||
case 0x06731095: | |||||
return ("CMD Tech 673 (USB0673) USB controller"); | |||||
case 0xc8611045: | |||||
return ("OPTi 82C861 (FireLink) USB controller"); | |||||
case 0x00351033: | |||||
return ("NEC uPD 9210 USB controller"); | |||||
case 0x00d710de: | |||||
return ("nVidia nForce3 USB Controller"); | |||||
case 0x005a10de: | |||||
return ("nVidia nForce CK804 USB Controller"); | |||||
case 0x036c10de: | |||||
return ("nVidia nForce MCP55 USB Controller"); | |||||
case 0x03f110de: | |||||
return ("nVidia nForce MCP61 USB Controller"); | |||||
case 0x0aa510de: | |||||
return ("nVidia nForce MCP79 USB Controller"); | |||||
case 0x0aa710de: | |||||
return ("nVidia nForce MCP79 USB Controller"); | |||||
case 0x0aa810de: | |||||
return ("nVidia nForce MCP79 USB Controller"); | |||||
case 0x70011039: | |||||
return ("SiS 5571 USB controller"); | |||||
case 0x1103108e: | |||||
return "Sun PCIO-2 USB controller"; | |||||
case 0x0019106b: | |||||
return ("Apple KeyLargo USB controller"); | |||||
case 0x003f106b: | |||||
return ("Apple KeyLargo/Intrepid USB controller"); | |||||
default: | |||||
break; | |||||
} | |||||
if ((pci_get_class(self) == PCIC_SERIALBUS) && | if ((pci_get_class(self) == PCIC_SERIALBUS) && | ||||
(pci_get_subclass(self) == PCIS_SERIALBUS_USB) && | (pci_get_subclass(self) == PCIS_SERIALBUS_USB) && | ||||
(pci_get_progif(self) == PCI_INTERFACE_OHCI)) { | (pci_get_progif(self) == PCI_INTERFACE_OHCI)) { | ||||
return ("OHCI (generic) USB controller"); | return ("OHCI (generic) USB controller"); | ||||
} | else | ||||
return (NULL); | return (NULL); | ||||
} | } | ||||
return (ohcid->descr); | |||||
} | |||||
static int | static int | ||||
ohci_pci_probe(device_t self) | ohci_pci_probe(device_t self) | ||||
{ | { | ||||
const char *desc = ohci_pci_match(self); | const char *desc = ohci_pci_match(self); | ||||
if (desc) { | if (desc) { | ||||
device_set_desc(self, desc); | device_set_desc(self, desc); | ||||
return (0); | return (0); | ||||
} else { | } else { | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
} | |||||
static int | static int | ||||
ohci_pci_attach(device_t self) | ohci_pci_attach(device_t self) | ||||
{ | { | ||||
ohci_softc_t *sc = device_get_softc(self); | ohci_softc_t *sc = device_get_softc(self); | ||||
int rid; | int rid; | ||||
int err; | int err; | ||||
▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | static driver_t ohci_driver = { | ||||
.name = "ohci", | .name = "ohci", | ||||
.methods = ohci_pci_methods, | .methods = ohci_pci_methods, | ||||
.size = sizeof(struct ohci_softc), | .size = sizeof(struct ohci_softc), | ||||
}; | }; | ||||
static devclass_t ohci_devclass; | static devclass_t ohci_devclass; | ||||
DRIVER_MODULE(ohci, pci, ohci_driver, ohci_devclass, 0, 0); | DRIVER_MODULE(ohci, pci, ohci_driver, ohci_devclass, 0, 0); | ||||
PCI_PNP_INFO(ohci_devs); | |||||
MODULE_DEPEND(ohci, usb, 1, 1, 1); | MODULE_DEPEND(ohci, usb, 1, 1, 1); |