{\r
int i=0, id=-1;\r
int ret;\r
- Uint16 base;\r
\r
ENTER("");\r
\r
// Enumerate PCI Bus, getting a maximum of `MAX_CONTROLLERS` devices\r
while( (id = PCI_GetDeviceByClass(0x0C03, 0xFFFF, id)) >= 0 && i < MAX_CONTROLLERS )\r
{\r
+ // NOTE: Check "protocol" from PCI?\r
+ \r
gUHCI_Controllers[i].PciId = id;\r
// Assign a port range (BAR4, Reserve 32 ports)\r
- base = PCI_AssignPort( id, 4, 0x20 );\r
- gUHCI_Controllers[i].IOBase = base;\r
+ //base = PCI_AssignPort( id, 4, 0x20 );\r
+ gUHCI_Controllers[i].IOBase = PCI_GetBAR4(id);\r
+ gUHCI_Controllers[i].IRQNum = PCI_GetIRQ(id);\r
\r
- Log("[USB ] Controller PCI #%i: IO Base = 0x%x", id, base);\r
+ Log("[USB ] Controller PCI #%i: IO Base = 0x%x, IRQ %i",\r
+ id, gUHCI_Controllers[i].IOBase, gUHCI_Controllers[i].IRQNum);\r
\r
// Initialise Host\r
ret = UHCI_Int_InitHost(&gUHCI_Controllers[i]);\r
{\r
ENTER("pHost", Host);\r
\r
+ outw( Host->IOBase + USBCMD, 4 ); // GRESET\r
+ // TODO: Wait for at least 10ms\r
+ outw( Host->IOBase + USBCMD, 0 ); // GRESET\r
+ \r
// Allocate Frame List\r
Host->FrameList = (void *) MM_AllocDMA(1, 32, &Host->PhysFrameList); // 1 Page, 32-bit\r
if( !Host->FrameList ) {\r
- Warning("[UHCI ] Unable to allocate frame list, aborting");\r
+ Log_Warning("UHCI", "Unable to allocate frame list, aborting");\r
LEAVE('i', -1);\r
return -1;\r
}\r