From: John Hodge Date: Thu, 13 Sep 2012 05:28:40 +0000 (+0800) Subject: Modules/EHCI - Debug output, nowhere near usable yet X-Git-Tag: rel0.15~706^2~14 X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=commitdiff_plain;h=8d52238daeb2bbbdf384f9d36721ef4ac8e9d36e Modules/EHCI - Debug output, nowhere near usable yet --- diff --git a/KernelLand/Modules/USB/EHCI/ehci.c b/KernelLand/Modules/USB/EHCI/ehci.c index 8a316e35..645e142b 100644 --- a/KernelLand/Modules/USB/EHCI/ehci.c +++ b/KernelLand/Modules/USB/EHCI/ehci.c @@ -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); } + + } // -------------------------------------------------------------------- diff --git a/KernelLand/Modules/USB/EHCI/ehci.h b/KernelLand/Modules/USB/EHCI/ehci.h index f76b93be..366f1606 100644 --- a/KernelLand/Modules/USB/EHCI/ehci.h +++ b/KernelLand/Modules/USB/EHCI/ehci.h @@ -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 *