00001 00013 #include "devices/pci.h" 00014 #include "devices/usb.h" 00015 #include <stdlib.h> 00016 #include <stdio.h> 00017 00018 /* capability registers */ 00019 #define EHCI_REG_CAPLENGTH 0x00 00020 00021 /* operational regisers - must be offset by op_base */ 00022 #define EHCI_REG_CONFIGFLAG 0x40 00023 00024 void ehci_init (void); 00025 00026 00027 void 00028 ehci_init (void) 00029 { 00030 struct pci_dev *pd; 00031 int dev_num; 00032 00033 dev_num = 0; 00034 while ((pd = pci_get_dev_by_class (PCI_MAJOR_SERIALBUS, PCI_MINOR_USB, 00035 PCI_USB_IFACE_EHCI, dev_num)) != NULL) 00036 { 00037 struct pci_io *io; 00038 uint8_t op_base; 00039 00040 dev_num++; 00041 io = pci_io_enum (pd, NULL); 00042 if (io == NULL) 00043 { 00044 printf ("IO not found on EHCI device?\n"); 00045 continue; 00046 } 00047 printf ("Disabling the EHCI controller #%d\n", dev_num - 1); 00048 op_base = pci_reg_read8 (io, EHCI_REG_CAPLENGTH); 00049 00050 /* turn off EHCI routing */ 00051 pci_reg_write32 (io, EHCI_REG_CONFIGFLAG + op_base, 0); 00052 } 00053 }