Author: rgampa Date: Tue Aug 8 10:28:56 2017 New Revision: 75504 URL: http://svn.reactos.org/svn/reactos?rev=75504&view=rev Log: [USBXHCI] -minor changes to root hub functions. -Finally driver is generating multiple interrupts. -DPRINTS in common functions removed to reduce windbg outputs CORE-13344
Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h?rev=75504&r1=75503&r2=75504&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/hardware.h [iso-8859-1] Tue Aug 8 10:28:56 2017 @@ -199,7 +199,7 @@ } XHCI_CONFIGURE; C_ASSERT(sizeof(XHCI_CONFIGURE) == sizeof(ULONG)); -#define PORT_STATUS_MASK 0x4F01FFE5 // 0100 1111 0000 0001 1111 1111 1110 0101 // RW 1, RW1C/RW1S 0, RO 1 +#define PORT_STATUS_MASK 0x4F01FFE9 // 0100 1111 0000 0001 1111 1111 1110 1001 // RW 1, RW1C/RW1S 0, RO 1 typedef volatile union _XHCI_PORT_STATUS_CONTROL { struct { ULONG CurrentConnectStatus : 1; Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c?rev=75504&r1=75503&r2=75504&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/roothub.c [iso-8859-1] Tue Aug 8 10:28:56 2017 @@ -52,17 +52,18 @@ IN USHORT Port, IN PULONG PortStatus) { - DPRINT1("XHCI_RH_GetPortStatus: function initiated\n"); + //DPRINT1("XHCI_RH_GetPortStatus: function initiated\n"); PXHCI_EXTENSION XhciExtension; PULONG PortStatusRegPointer; XHCI_PORT_STATUS_CONTROL PortStatusRegister; USBHUB_PORT_STATUS portstatus; XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; //DPRINT("XHCI_RH_GetPortStatus: Port - %i\n", Port); - DPRINT("XHCI_RH_GetPortStatus: PortStatus Register, port - %p , %i\n", PortStatusRegister.AsULONG, Port); + //DPRINT("XHCI_RH_GetPortStatus: PortStatus Register, port - %p , %i\n", PortStatusRegister.AsULONG, Port); /* ULONG ConnectStatus : 1; // Current Connect Status ULONG EnableStatus : 1; // Port Enabled/Disabled @@ -153,7 +154,7 @@ XHCI_RH_GetHubStatus(IN PVOID xhciExtension, IN PULONG HubStatus) { - DPRINT1("XHCI_RH_GetHubStatus: function initiated\n"); + //DPRINT1("XHCI_RH_GetHubStatus: function initiated\n"); *HubStatus = 0; return 0; } @@ -184,10 +185,10 @@ PXHCI_EXTENSION XhciExtension; PULONG PortStatusRegPointer; XHCI_PORT_STATUS_CONTROL PortStatusRegister; - LARGE_INTEGER CurrentTime = {{0, 0}}; - LARGE_INTEGER LastTime = {{0, 0}}; - - XhciExtension = (PXHCI_EXTENSION)xhciExtension; + + + XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; @@ -196,27 +197,7 @@ WRITE_REGISTER_ULONG(PortStatusRegPointer , PortStatusRegister.AsULONG ); - KeQuerySystemTime(&CurrentTime); - CurrentTime.QuadPart += 100 * 10000; // 100 msec - while(TRUE) - { - KeQuerySystemTime(&LastTime); - - PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; - - if (PortStatusRegister.PortReset!= 1) - { - break; - } - - if (LastTime.QuadPart >= CurrentTime.QuadPart) - { - DPRINT1("XHCI_RH_SetFeaturePortReset: Software Reset failed!\n"); - return MP_STATUS_FAILURE; - } - } - - + return MP_STATUS_SUCCESS; } @@ -231,6 +212,7 @@ XHCI_PORT_STATUS_CONTROL PortStatusRegister; XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; @@ -315,6 +297,7 @@ XHCI_PORT_STATUS_CONTROL PortStatusRegister; XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; @@ -324,9 +307,8 @@ WRITE_REGISTER_ULONG(PortStatusRegPointer , PortStatusRegister.AsULONG ); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; - if (PortStatusRegister.ConnectStatusChange == 1){ - return MP_STATUS_FAILURE; - } + + ASSERT(PortStatusRegister.ConnectStatusChange == 0); return MP_STATUS_SUCCESS; } @@ -341,6 +323,7 @@ XHCI_PORT_STATUS_CONTROL PortStatusRegister; XhciExtension = (PXHCI_EXTENSION)xhciExtension; + ASSERT(Port != 0 && Port <= XhciExtension->NumberOfPorts); PortStatusRegPointer = (XhciExtension->OperationalRegs) + (XHCI_PORTSC + (Port - 1)*4); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; @@ -351,9 +334,8 @@ WRITE_REGISTER_ULONG(PortStatusRegPointer , PortStatusRegister.AsULONG ); PortStatusRegister.AsULONG = READ_REGISTER_ULONG(PortStatusRegPointer) ; - if (PortStatusRegister.PortResetChange == 1){ - return MP_STATUS_FAILURE; - } + + ASSERT(PortStatusRegister.PortResetChange == 0); return MP_STATUS_SUCCESS; } @@ -379,7 +361,7 @@ NTAPI XHCI_RH_DisableIrq(IN PVOID xhciExtension) { - DPRINT1("XHCI_RH_DisableIrq: function initiated\n"); + //DPRINT1("XHCI_RH_DisableIrq: function initiated\n"); PXHCI_EXTENSION XhciExtension; PULONG OperationalRegs; XHCI_USB_COMMAND usbCommand; @@ -398,7 +380,7 @@ NTAPI XHCI_RH_EnableIrq(IN PVOID xhciExtension) { - DPRINT1("XHCI_RH_EnableIrq: function initiated\n"); + //DPRINT1("XHCI_RH_EnableIrq: function initiated\n"); PXHCI_EXTENSION XhciExtension; PULONG OperationalRegs; XHCI_USB_COMMAND usbCommand; Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c?rev=75504&r1=75503&r2=75504&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.c [iso-8859-1] Tue Aug 8 10:28:56 2017 @@ -559,14 +559,14 @@ erstdp.DequeueERSTIndex =0; XHCI_Write64bitReg (RunTimeRegisterBase + XHCI_ERSTDP, erstdp.AsULONGLONG); - PXHCI_HC_RESOURCES HcResourcesVA; + /*PXHCI_HC_RESOURCES HcResourcesVA; XHCI_TRB eventtrb; HcResourcesVA = XhciExtension->HcResourcesVA; eventtrb = HcResourcesVA -> EventRing.firstSeg.XhciTrb[0]; DPRINT("XHCI_ControllerWorkTest: eventtrb word0 - %p\n", eventtrb.EventTRB.Word0); DPRINT("XHCI_ControllerWorkTest: eventtrb word1 - %p\n", eventtrb.EventTRB.Word1); DPRINT("XHCI_ControllerWorkTest: eventtrb word2 - %p\n", eventtrb.EventTRB.Word2); - DPRINT("XHCI_ControllerWorkTest: eventtrb word3 - %p\n", eventtrb.EventTRB.Word3); + DPRINT("XHCI_ControllerWorkTest: eventtrb word3 - %p\n", eventtrb.EventTRB.Word3);*/ return TRUE; } @@ -735,7 +735,7 @@ NTAPI XHCI_PollController(IN PVOID xhciExtension) { - DPRINT1("XHCI_PollController: function initiated\n"); + //DPRINT1("XHCI_PollController: function initiated\n"); PXHCI_EXTENSION XhciExtension; PULONG OperationalRegs; //ULONG Port;