Author: rgampa Date: Thu Aug 24 13:04:30 2017 New Revision: 75658 URL: http://svn.reactos.org/svn/reactos?rev=75658&view=rev Log: [USBXHCI] - Changed inf file to fix device descriptons - Added licence headers for all files in xhci folder - Wrote the stop controller function to disable the controller safely and re-enable - defined NDEBUG to reduce windbg output or noisy functions CORE-13344
Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/dbg_xhci.h branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/debug.c 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 branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h branches/GSoC_2017/usbxhci/reactos/media/inf/usbport.inf Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/dbg_xhci.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/dbg_xhci.h?rev=75658&r1=75657&r2=75658&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/dbg_xhci.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/dbg_xhci.h [iso-8859-1] Thu Aug 24 13:04:30 2017 @@ -1,3 +1,9 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: debug header files + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ #ifndef DBG_XHCI_H__ #define DBG_XHCI_H__ Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/debug.c URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/debug.c?rev=75658&r1=75657&r2=75658&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/debug.c [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/debug.c [iso-8859-1] Thu Aug 24 13:04:30 2017 @@ -1,3 +1,9 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: debug functions + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ #include "usbxhci.h" #define NDEBUG 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=75658&r1=75657&r2=75658&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] Thu Aug 24 13:04:30 2017 @@ -1,4 +1,10 @@ -/* XHCI hardware registers */ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: hardware register definitions + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ + // base io addr register offsets #define XHCI_HCSP1 1 #define XHCI_HCSP2 2 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=75658&r1=75657&r2=75658&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] Thu Aug 24 13:04:30 2017 @@ -1,5 +1,11 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: roothub functions of xHCI + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ #include "usbxhci.h" -//#define NDEBUG +#define NDEBUG #include <debug.h> #define NDEBUG_XHCI_ROOT_HUB #include "dbg_xhci.h" @@ -89,7 +95,7 @@ XHCI_RH_GetHubStatus(IN PVOID xhciExtension, IN PUSB_HUB_STATUS_AND_CHANGE HubStatus) { - //DPRINT1("XHCI_RH_GetHubStatus: function initiated\n"); //removed to reduce windbg output + DPRINT("XHCI_RH_GetHubStatus: function initiated\n"); //removed to reduce windbg output HubStatus->AsUlong32 = 0; return 0; } @@ -311,11 +317,12 @@ NTAPI XHCI_RH_DisableIrq(IN PVOID xhciExtension) { - //DPRINT1("XHCI_RH_DisableIrq: function initiated\n"); removed to reduce windbg output + PXHCI_EXTENSION XhciExtension; PULONG OperationalRegs; XHCI_USB_COMMAND usbCommand; + DPRINT("XHCI_RH_DisableIrq: function initiated\n"); XhciExtension = (PXHCI_EXTENSION)xhciExtension; OperationalRegs = XhciExtension->OperationalRegs; usbCommand.AsULONG =READ_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD); @@ -329,11 +336,12 @@ NTAPI XHCI_RH_EnableIrq(IN PVOID xhciExtension) { - //DPRINT1("XHCI_RH_EnableIrq: function initiated\n"); removed to reduce windbg output + PXHCI_EXTENSION XhciExtension; PULONG OperationalRegs; XHCI_USB_COMMAND usbCommand; + DPRINT("XHCI_RH_EnableIrq: function initiated\n"); XhciExtension = (PXHCI_EXTENSION)xhciExtension; OperationalRegs = XhciExtension->OperationalRegs; usbCommand.AsULONG =READ_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD); 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=75658&r1=75657&r2=75658&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] Thu Aug 24 13:04:30 2017 @@ -1,6 +1,14 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: main functions of xHCI + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ #include "usbxhci.h" +#define NDEBUG #include <debug.h> #define NDEBUG_XHCI_TRACE + #include "dbg_xhci.h" USBPORT_REGISTRATION_PACKET RegPacket; @@ -571,7 +579,7 @@ return MP_STATUS_FAILURE; } } - DPRINT("XHCI_InitializeHardware: Reset - OK\n"); + DPRINT1("XHCI_InitializeHardware: Reset - OK\n"); StructuralParams_1.AsULONG = READ_REGISTER_ULONG(BaseIoAdress + XHCI_HCSP1); // HCSPARAMS1 register @@ -649,12 +657,12 @@ MaxScratchPadBuffers = MaxScratchPadBuffers + HCSPARAMS2.MaxSPBuffersLo; XhciExtension->MaxScratchPadBuffers = MaxScratchPadBuffers; - DPRINT("XHCI_StartController: BaseIoAdress - %p\n", BaseIoAdress); - DPRINT("XHCI_StartController: OperationalRegs - %p\n", OperationalRegs); - DPRINT("XHCI_StartController: DoorBellRegisterBase - %p\n", DoorBellRegisterBase); - DPRINT("XHCI_StartController: RunTimeRegisterBase - %p\n", RunTimeRegisterBase); - DPRINT("XHCI_StartController: PageSize - %p\n", XhciExtension->PageSize); - DPRINT("XHCI_StartController: MaxScratchPadBuffers - %p\n", MaxScratchPadBuffers); + DPRINT1("XHCI_StartController: BaseIoAdress - %p\n", BaseIoAdress); + DPRINT1("XHCI_StartController: OperationalRegs - %p\n", OperationalRegs); + DPRINT1("XHCI_StartController: DoorBellRegisterBase - %p\n", DoorBellRegisterBase); + DPRINT1("XHCI_StartController: RunTimeRegisterBase - %p\n", RunTimeRegisterBase); + DPRINT1("XHCI_StartController: PageSize - %p\n", XhciExtension->PageSize); + DPRINT1("XHCI_StartController: MaxScratchPadBuffers - %p\n", MaxScratchPadBuffers); RegPacket.UsbPortReadWriteConfigSpace(XhciExtension, 1, @@ -705,8 +713,13 @@ PMDL ScratchPadArrayMDL; PMDL ScratchPadBufferMDL; PXHCI_SCRATCHPAD_BUFFER_ARRAY BufferArrayPointer; - - DPRINT1("XHCI_StopController: Function initiated. FIXME\n"); + XHCI_USB_COMMAND Command, Command_temp; + PULONG OperationalRegs; + XHCI_USB_STATUS Status; + LARGE_INTEGER CurrentTime = {{0, 0}}; + LARGE_INTEGER LastTime = {{0, 0}}; + + DPRINT1("XHCI_StopController: Function initiated. \n"); XhciExtension = (PXHCI_EXTENSION) xhciExtension; MaxScratchPadBuffers = XhciExtension->MaxScratchPadBuffers; // free memory allocated to scratchpad buffers. @@ -722,6 +735,33 @@ IoFreeMdl(ScratchPadArrayMDL); MmFreeContiguousMemory(BufferArrayPointer); } + + OperationalRegs = XhciExtension->OperationalRegs; + Command_temp.AsULONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD); + Command.AsULONG = 0; + Command.RsvdP1 = Command_temp.RsvdP1; + Command.RsvdP2 = Command_temp.RsvdP2; + Command.RsvdP3 = Command_temp.RsvdP3; + WRITE_REGISTER_ULONG(OperationalRegs + XHCI_USBCMD, Command.AsULONG); + + KeQuerySystemTime(&CurrentTime); + CurrentTime.QuadPart += 100 * 10000; + while (TRUE) + { + KeQuerySystemTime(&LastTime); + + Status.AsULONG = READ_REGISTER_ULONG(OperationalRegs + XHCI_USBSTS); + + if (Status.HCHalted == 1) + { + break; + } + + if (LastTime.QuadPart >= CurrentTime.QuadPart) + { + DPRINT1("XHCI_StopController: controller stop failed!\n"); + } + } } @@ -877,14 +917,14 @@ NTAPI XHCI_CheckController(IN PVOID xhciExtension) { - //DPRINT1("XHCI_CheckController: function initiated\n"); + DPRINT("XHCI_CheckController: function initiated\n"); } ULONG NTAPI XHCI_Get32BitFrameNumber(IN PVOID xhciExtension) { - //DPRINT1("XHCI_Get32BitFrameNumber: function initiated\n"); this function is called multiple times. commented out to reduce output in windbg + DPRINT("XHCI_Get32BitFrameNumber: function initiated\n"); return 0; } @@ -937,9 +977,9 @@ NTAPI XHCI_PollController(IN PVOID xhciExtension) { - //DPRINT1("XHCI_PollController: function initiated\n"); commented out to reduce windbg output + PXHCI_EXTENSION XhciExtension; - + DPRINT("XHCI_PollController: function initiated\n"); XhciExtension = (PXHCI_EXTENSION)xhciExtension; if (!(XhciExtension->Flags & XHCI_FLAGS_CONTROLLER_SUSPEND)) @@ -1062,7 +1102,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject, IN PUNICODE_STRING RegistryPath) { - DPRINT("DriverEntry: DriverObject - %p, RegistryPath - %wZ\n", + DPRINT1("DriverEntry: DriverObject - %p, RegistryPath - %wZ\n", DriverObject, RegistryPath); if (USBPORT_GetHciMn() != USBPORT_HCI_MN) Modified: branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h?rev=75658&r1=75657&r2=75658&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/drivers/usb/usbxhci/usbxhci.h [iso-8859-1] Thu Aug 24 13:04:30 2017 @@ -1,3 +1,9 @@ +/* + * PROJECT: ReactOS system libraries + * LICENSE: GPLv2+ - See COPYING in the top level directory + * PURPOSE: resources definitions + * PROGRAMMER: Rama Teja Gampa <ramatej...@gmail.com> +*/ #ifndef USBXHCI_H__ #define USBXHCI_H__ Modified: branches/GSoC_2017/usbxhci/reactos/media/inf/usbport.inf URL: http://svn.reactos.org/svn/reactos/branches/GSoC_2017/usbxhci/reactos/media/inf/usbport.inf?rev=75658&r1=75657&r2=75658&view=diff ============================================================================== --- branches/GSoC_2017/usbxhci/reactos/media/inf/usbport.inf [iso-8859-1] (original) +++ branches/GSoC_2017/usbxhci/reactos/media/inf/usbport.inf [iso-8859-1] Thu Aug 24 13:04:30 2017 @@ -142,6 +142,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB controller" PCI\CC_0C0310.DeviceDesc = "OHCI USB controller" PCI\CC_0C0320.DeviceDesc = "EHCI USB controller" +PCI\CC_0C0330.DeviceDesc = "XHCI USB controller" USB\ROOT_HUB.DeviceDesc = "Root hub" IntelMfg = "Intel" @@ -155,6 +156,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB ÅadiÄ" PCI\CC_0C0310.DeviceDesc = "OHCI USB ÅadiÄ" PCI\CC_0C0320.DeviceDesc = "EHCI USB ÅadiÄ" +PCI\CC_0C0330.DeviceDesc = "XHCI USB ÅadiÄ" USB\ROOT_HUB.DeviceDesc = "KoÅenový rozboÄovaÄ" IntelMfg = "Intel" @@ -168,6 +170,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB-Controller" PCI\CC_0C0310.DeviceDesc = "OHCI USB-Controller" PCI\CC_0C0320.DeviceDesc = "EHCI USB-Controller" +PCI\CC_0C0330.DeviceDesc = "XHCI USB-Controller" USB\ROOT_HUB.DeviceDesc = "Root Hub" [Strings.0a] @@ -178,6 +181,7 @@ PCI\CC_0C0300.DeviceDesc = "Controlador USB UHCI" PCI\CC_0C0310.DeviceDesc = "Controlador USB OHCI" PCI\CC_0C0320.DeviceDesc = "Controlador USB EHCI USB" +PCI\CC_0C0330.DeviceDesc = "Controlador USB XHCI" USB\ROOT_HUB.DeviceDesc = "Concentrador raÃz USB" IntelMfg = "Intel" @@ -192,6 +196,7 @@ PCI\CC_0C0300.DeviceDesc = "Contrôleur USB UHCI" PCI\CC_0C0310.DeviceDesc = "Contrôleur USB OHCI" PCI\CC_0C0320.DeviceDesc = "Contrôleur USB EHCI" +PCI\CC_0C0330.DeviceDesc = "Contrôleur USB XHCI" USB\ROOT_HUB.DeviceDesc = "Concentrateur racine" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "Contrôleur USB Intel 82371SB PIIX3" @@ -204,6 +209,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB ã³ã³ããã¼ã©" PCI\CC_0C0310.DeviceDesc = "OHCI USB ã³ã³ããã¼ã©" PCI\CC_0C0320.DeviceDesc = "EHCI USB ã³ã³ããã¼ã©" +PCI\CC_0C0330.DeviceDesc = "XHCI USB ã³ã³ããã¼ã©" USB\ROOT_HUB.DeviceDesc = "ã«ã¼ã ãã" [Strings.0415] @@ -214,6 +220,7 @@ PCI\CC_0C0300.DeviceDesc = "Kontroler UHCI USB" PCI\CC_0C0310.DeviceDesc = "Kontroler OHCI USB" PCI\CC_0C0320.DeviceDesc = "Kontroler EHCI USB" +PCI\CC_0C0330.DeviceDesc = "Kontroler XHCI USB" USB\ROOT_HUB.DeviceDesc = "GÅówny koncentrator USB" IntelMfg = "Intel" @@ -227,6 +234,7 @@ PCI\CC_0C0300.DeviceDesc = "Controlador USB UHCI" PCI\CC_0C0310.DeviceDesc = "Controlador USB OHCI" PCI\CC_0C0320.DeviceDesc = "Controlador USB EHCI USB" +PCI\CC_0C0330.DeviceDesc = "Controlador USB XHCI" USB\ROOT_HUB.DeviceDesc = "Concentrador raÃz USB" IntelMfg = "Intel" @@ -240,6 +248,7 @@ PCI\CC_0C0300.DeviceDesc = "Dispozitive de control USB UHCI" PCI\CC_0C0310.DeviceDesc = "Dispozitive de control USB OHCI" PCI\CC_0C0320.DeviceDesc = "Dispozitive de control USB EHCI" +PCI\CC_0C0330.DeviceDesc = "Dispozitive de control USB XHCI" USB\ROOT_HUB.DeviceDesc = "Cuplator rÄdÄcinÄ" IntelMfg = "Intel" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "Dispozitiv de control USB Intel 82371SB PIIX3" @@ -253,6 +262,7 @@ PCI\CC_0C0300.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ UHCI USB" PCI\CC_0C0310.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ OHCI USB" PCI\CC_0C0320.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ EHCI USB" +PCI\CC_0C0330.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ XHCI USB" USB\ROOT_HUB.DeviceDesc = "ÐоÑневой Ñ Ð°Ð±" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ Intel 82371SB PIIX3 USB" @@ -265,6 +275,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB radiÄ" PCI\CC_0C0310.DeviceDesc = "OHCI USB radiÄ" PCI\CC_0C0320.DeviceDesc = "EHCI USB radiÄ" +PCI\CC_0C0330.DeviceDesc = "XHCI USB radiÄ" USB\ROOT_HUB.DeviceDesc = "KoreÅový rozboÄovaÄ" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "Intel 82371SB PIIX3 USB radiÄ" @@ -277,6 +288,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB valdiklis" PCI\CC_0C0310.DeviceDesc = "OHCI USB valdiklis" PCI\CC_0C0320.DeviceDesc = "EHCI USB valdiklis" +PCI\CC_0C0330.DeviceDesc = "XHCI USB valdiklis" USB\ROOT_HUB.DeviceDesc = "Pagrindinis Å¡akotuvas" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "Intel 82371SB PIIX3 USB valdiklis" @@ -290,6 +302,7 @@ PCI\CC_0C0300.DeviceDesc = "UHCI USB Denetleyicisi" PCI\CC_0C0310.DeviceDesc = "OHCI USB Denetleyicisi" PCI\CC_0C0320.DeviceDesc = "EHCI USB Denetleyicisi" +PCI\CC_0C0330.DeviceDesc = "XHCI USB Denetleyicisi" USB\ROOT_HUB.DeviceDesc = "Kök Göbek" IntelMfg = "Intel" @@ -304,6 +317,7 @@ PCI\CC_0C0300.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ UHCI USB" PCI\CC_0C0310.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ OHCI USB" PCI\CC_0C0320.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ EHCI USB" +PCI\CC_0C0330.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ XHCI USB" USB\ROOT_HUB.DeviceDesc = "ÐоÑеневий Ñ Ð°Ð±" PCI\VEN_8086&DEV_7020&CC_0C0300.DeviceDesc = "ÐонÑÑÐ¾Ð»Ð»ÐµÑ Intel 82371SB PIIX3 USB"