Merge branch 'master' of git://github.com/thepowersgang/acess2
[tpg/acess2.git] / KernelLand / Modules / USB / EHCI / ehci.c
index 50004c7..a2acca2 100644 (file)
@@ -94,9 +94,32 @@ int EHCI_Initialise(char **Arguments)
                        // TODO: Detect other forms of failure than "out of slots"
                        break ;
                }
+       }
 
-               // TODO: Register with the USB stack
+       for( int i = 0; Arguments[i]; i ++ )
+       {
+               char *pos = Arguments[i], *next;
+               LOG("pos = '%s'", pos);
+               tPAddr base = strtoull(pos, &next, 16);
+               if( base == 0 )
+                       continue;
+               pos = next;
+               LOG("pos = '%s'", pos);
+               if( *pos++ != '-' )
+                       continue;
+               LOG("pos = '%s'", pos);
+               int irq = strtol(pos, &next, 16);
+               if( irq == 0 )
+                       continue ;
+               if( *next != 0 )
+                       continue;
+               LOG("base=%x, irq=%i", base, irq);
+               if( EHCI_InitController(base, irq) )
+               {
+                       continue ;
+               }
        }
+
        return 0;
 }
 
@@ -137,7 +160,8 @@ int EHCI_InitController(tPAddr BaseAddress, Uint8 InterruptNum)
        }
        // TODO: Error check
        if( (cont->CapRegs->CapLength & 3) ) {
-               Log_Warning("EHCI", "Controller at %P non-aligned op regs", BaseAddress);
+               Log_Warning("EHCI", "Controller at %P non-aligned op regs (%x)",
+                       BaseAddress, cont->CapRegs->CapLength);
                goto _error;
        }
        cont->OpRegs = (void*)( (Uint32*)cont->CapRegs + cont->CapRegs->CapLength / 4 );
@@ -268,6 +292,8 @@ void *EHCI_InitInterrupt(void *Ptr, int Endpoint, int bOutbound, int Period,
        if( Period > 256 )
                Period = 256;
 
+       LOG("Endpoint=%x, bOutbound=%i, Period=%i, Length=%i", Endpoint, bOutbound, Period, Length);
+
        // Round the period to the closest power of two
        pow2period = 1;
        period_pow = 0;
@@ -433,6 +459,8 @@ void *EHCI_SendControl(void *Ptr, void *Dest, tUSBHostCb Cb, void *CbData,
        if( (tVAddr)Dest <= 256*16 )
                return NULL;
 
+       LOG("Dest=%p, isOutbound=%i, Lengths(Setup:%i,Out:%i,In:%i)", Dest, isOutbound, SetupLength, OutLength, InLength);
+
        // Check size of SETUP and status
        
        // Allocate TDs

UCC git Repository :: git.ucc.asn.au