Modules/EHCI - Debug output, nowhere near usable yet
authorJohn Hodge <[email protected]>
Thu, 13 Sep 2012 05:28:40 +0000 (13:28 +0800)
committerJohn Hodge <[email protected]>
Thu, 13 Sep 2012 05:28:40 +0000 (13:28 +0800)
KernelLand/Modules/USB/EHCI/ehci.c
KernelLand/Modules/USB/EHCI/ehci.h

index 8a316e3..645e142 100644 (file)
@@ -71,10 +71,16 @@ int EHCI_Initialise(char **Arguments)
                        // TODO: The same
                }
 
-               if( EHCI_InitController(addr, irq) ) {
+               Log_Log("ECHI", "Controller at PCI %i 0x%x IRQ 0x%x",
+                       id, addr, irq);
+
+               if( EHCI_InitController(addr, irq) )
+               {
                        // TODO: Detect other forms of failure than "out of slots"
                        break ;
                }
+
+               // TODO: Register with the USB stack
        }
        return 0;
 }
@@ -99,6 +105,7 @@ int EHCI_InitController(tPAddr BaseAddress, Uint8 InterruptNum)
        }
 
        if(!cont) {
+               Log_Notice("EHCI", "Too many controllers (EHCI_MAX_CONTROLLERS=%i)", EHCI_MAX_CONTROLLERS);
                return 1;
        }
 
@@ -138,6 +145,14 @@ void EHCI_InterruptHandler(int IRQ, void *Ptr)
        // Clear interrupts
        cont->OpRegs->USBSts = sts;     
 
+       if( sts & 0xFFFF0FC0 ) {
+               LOG("Oops, reserved bits set (%08x), funny hardware?", sts);
+               sts &= ~0xFFFF0FFC0;
+       }
+
+       // Unmask read-only bits
+       sts &= ~(0xF000);
+
        if( sts & USBINTR_IOC ) {
                // IOC
                sts &= ~USBINTR_IOC;
@@ -145,18 +160,23 @@ void EHCI_InterruptHandler(int IRQ, void *Ptr)
 
        if( sts & USBINTR_PortChange ) {
                // Port change, determine what port and poke helper thread
+               LOG("Port status change");
                sts &= ~USBINTR_PortChange;
        }
        
        if( sts & USBINTR_FrameRollover ) {
                // Frame rollover, used to aid timing (trigger per-second operations)
+               LOG("Frame rollover");
                sts &= ~USBINTR_FrameRollover;
        }
 
        if( sts ) {
                // Unhandled interupt bits
                // TODO: Warn
+               LOG("WARN - Bitmask %x unhandled", sts);
        }
+
+
 }
 
 // --------------------------------------------------------------------
index f76b93b..366f160 100644 (file)
@@ -92,7 +92,7 @@ struct sEHCI_OpRegs
         * 15    = Asynchronous Schedule Status
         * 16:31 = Reserved ?(Zero)
         */
-       Uint32  USBSts;
+       volatile Uint32 USBSts;
        /**
         * USB Interrupt Enable Register
         *
@@ -110,7 +110,7 @@ struct sEHCI_OpRegs
         * 
         * Bits 14:3 are used as n index into PeridocListBase
         */
-       Uint32  FrIndex;
+       volatile Uint32 FrIndex;
        /**
         * Control Data Structure Segment Register
         *

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