ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
March 2018
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
25 participants
436 discussions
Start a n
N
ew thread
19/77: [USBPORT] Correcting USBPORT_InitializeDevice() and USBPORT_RestoreDevice() (DEVICE_HANDLE_FLAG_USB2HUB).
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cbba6e80fce48aaf11636…
commit cbba6e80fce48aaf1163603738d1b09a8eef88f5 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Nov 28 15:19:46 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:41 2018 +0100 [USBPORT] Correcting USBPORT_InitializeDevice() and USBPORT_RestoreDevice() (DEVICE_HANDLE_FLAG_USB2HUB). --- drivers/usb/usbport/device.c | 12 +++++++++++- drivers/usb/usbport/usbport.h | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index f1cb04eb47..7ba54f594e 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -1377,6 +1377,12 @@ USBPORT_InitializeDevice(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, (MaxPacketSize == 16) || (MaxPacketSize == 32) || (MaxPacketSize == 64)); + + if (DeviceHandle->DeviceSpeed == UsbHighSpeed && + DeviceHandle->DeviceDescriptor.bDeviceClass == USB_DEVICE_CLASS_HUB) + { + DeviceHandle->Flags |= DEVICE_HANDLE_FLAG_USB2HUB; + } } else { @@ -1761,10 +1767,14 @@ USBPORT_RestoreDevice(IN PDEVICE_OBJECT FdoDevice, } } - if (NewDeviceHandle->Flags & DEVICE_HANDLE_FLAG_INITIALIZED) + if (NewDeviceHandle->Flags & DEVICE_HANDLE_FLAG_USB2HUB) { DPRINT1("USBPORT_RestoreDevice: FIXME Transaction Translator\n"); NewDeviceHandle->TtCount = OldDeviceHandle->TtCount; + +#ifndef NDEBUG + DbgBreakPoint(); +#endif } while (!IsListEmpty(&OldDeviceHandle->PipeHandleList)) diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 3bba591f06..940c944c48 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -104,7 +104,7 @@ /* Device handle Flags (USBPORT_DEVICE_HANDLE) */ #define DEVICE_HANDLE_FLAG_ROOTHUB 0x00000002 #define DEVICE_HANDLE_FLAG_REMOVED 0x00000008 -#define DEVICE_HANDLE_FLAG_INITIALIZED 0x00000010 +#define DEVICE_HANDLE_FLAG_USB2HUB 0x00000010 /* Endpoint Flags (USBPORT_ENDPOINT) */ #define ENDPOINT_FLAG_DMA_TYPE 0x00000001
6 years, 9 months
1
0
0
0
18/77: [USBPORT] Implement USBPORT_FreeBandwidth().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=664e48cad50ae7a707f2d…
commit 664e48cad50ae7a707f2dcaf7562fa460380b201 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Nov 28 15:13:22 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:40 2018 +0100 [USBPORT] Implement USBPORT_FreeBandwidth(). --- drivers/usb/usbport/endpoint.c | 58 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index 1e037f9ff4..23bccb14c3 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -173,7 +173,63 @@ NTAPI USBPORT_FreeBandwidth(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint) { - DPRINT1("USBPORT_FreeBandwidth: UNIMPLEMENTED. FIXME. \n"); + PUSBPORT_DEVICE_EXTENSION FdoExtension; + PUSBPORT_ENDPOINT_PROPERTIES EndpointProperties; + ULONG TransferType; + ULONG Offset; + ULONG EndpointBandwidth; + ULONG Period; + ULONG Factor; + UCHAR Bit; + + DPRINT("USBPORT_FreeBandwidth: FdoDevice - %p, Endpoint - %p\n", + FdoDevice, + Endpoint); + + FdoExtension = FdoDevice->DeviceExtension; + + EndpointProperties = &Endpoint->EndpointProperties; + TransferType = EndpointProperties->TransferType; + + if (TransferType == USBPORT_TRANSFER_TYPE_BULK || + TransferType == USBPORT_TRANSFER_TYPE_CONTROL || + (Endpoint->Flags & ENDPOINT_FLAG_ROOTHUB_EP0)) + { + return; + } + + Offset = Endpoint->EndpointProperties.ScheduleOffset; + EndpointBandwidth = Endpoint->EndpointProperties.UsbBandwidth; + Period = Endpoint->EndpointProperties.Period; + + ASSERT(USB2_FRAMES / Period); + + for (Factor = USB2_FRAMES / Period; Factor; Factor--) + { + FdoExtension->Bandwidth[Offset * Factor] += EndpointBandwidth; + } + + if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT) + { + for (Bit = 0x80; Bit != 0; Bit >>= 1) + { + if ((Period & Bit) != 0) + { + Period = Bit; + break; + } + } + + ASSERT(Period != 0); + + DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedInterrupt_XXms\n"); + } + else + { + DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedIso\n"); + } + + DPRINT1("USBPORT_FreeBandwidth: FIXME USBPORT_UpdateAllocatedBw\n"); } UCHAR
6 years, 9 months
1
0
0
0
17/77: [USBPORT] Implement USBPORT_AllocateBandwidth().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aae6dd6073971af6411f1…
commit aae6dd6073971af6411f1fc5ee9cb0ae70c30503 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Nov 28 15:02:47 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:40 2018 +0100 [USBPORT] Implement USBPORT_AllocateBandwidth(). --- drivers/usb/usbport/endpoint.c | 87 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 78 insertions(+), 9 deletions(-) diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index 49124ae763..1e037f9ff4 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -68,9 +68,19 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice, ULONG TransferType; ULONG TotalBusBandwidth; ULONG EndpointBandwidth; + ULONG MinBandwidth; + PULONG Bandwidth; + ULONG MaxBandwidth = 0; + ULONG ix; + ULONG Offset; + LONG ScheduleOffset = -1; ULONG Period; + ULONG Factor; + UCHAR Bit; - DPRINT("USBPORT_AllocateBandwidth: ... \n"); + DPRINT("USBPORT_AllocateBandwidth: FdoDevice - %p, Endpoint - %p\n", + FdoDevice, + Endpoint); FdoExtension = FdoDevice->DeviceExtension; EndpointProperties = &Endpoint->EndpointProperties; @@ -87,16 +97,75 @@ USBPORT_AllocateBandwidth(IN PDEVICE_OBJECT FdoDevice, TotalBusBandwidth = FdoExtension->TotalBusBandwidth; EndpointBandwidth = EndpointProperties->UsbBandwidth; Period = EndpointProperties->Period; + Factor = USB2_FRAMES / Period; + ASSERT(Factor); - DPRINT1("USBPORT_AllocateBandwidth: FIXME. \n"); - DPRINT1("USBPORT_AllocateBandwidth: Endpoint - %p, Type - %x, TotalBandwidth - %x, EpBandwidth - %x, Period - %x\n", - Endpoint, - TransferType, - TotalBusBandwidth, - EndpointBandwidth, - Period); + for (Offset = 0; Offset < Period; Offset++) + { + MinBandwidth = TotalBusBandwidth; + Bandwidth = &FdoExtension->Bandwidth[Offset * Factor]; + + for (ix = 0; *Bandwidth >= EndpointBandwidth; ix++) + { + if (MinBandwidth > *Bandwidth) + { + MinBandwidth = *Bandwidth; + } + + Bandwidth++; + + if (Factor <= (ix + 1)) + { + if (MinBandwidth > MaxBandwidth) + { + MaxBandwidth = MinBandwidth; + ScheduleOffset = Offset; + + DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n", + ScheduleOffset); + } + + break; + } + } + } + + DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n", ScheduleOffset); + + if (ScheduleOffset != -1) + { + EndpointProperties->ScheduleOffset = ScheduleOffset; + + Bandwidth = &FdoExtension->Bandwidth[ScheduleOffset * Factor]; + + for (Factor = USB2_FRAMES / Period; Factor; Factor--) + { + FdoExtension->Bandwidth[ScheduleOffset * Factor] -= EndpointBandwidth; + } + + if (TransferType == USBPORT_TRANSFER_TYPE_INTERRUPT) + { + for (Bit = 0x80; Bit != 0; Bit >>= 1) + { + if ((Period & Bit) != 0) + { + Period = Bit; + break; + } + } + + DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedInterrupt_XXms\n"); + } + else + { + DPRINT("USBPORT_AllocateBandwidth: FIXME AllocedIso\n"); + } + } + + DPRINT("USBPORT_AllocateBandwidth: FIXME USBPORT_UpdateAllocatedBw\n"); - return TRUE; + DPRINT("USBPORT_AllocateBandwidth: ScheduleOffset - %X\n", ScheduleOffset); + return ScheduleOffset != -1; } VOID
6 years, 9 months
1
0
0
0
16/77: [USBPORT] Add support for transaction translators in USBPORT_OpenPipe() and USBPORT_ClosePipe().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c6ca2a8f027e22091fd08…
commit c6ca2a8f027e22091fd08b1825a9298ec63ee5d8 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Tue Nov 28 14:41:05 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:40 2018 +0100 [USBPORT] Add support for transaction translators in USBPORT_OpenPipe() and USBPORT_ClosePipe(). --- drivers/usb/usbport/device.c | 2 +- drivers/usb/usbport/endpoint.c | 44 +++++++++++++++++++++++++++++++++++------- drivers/usb/usbport/usbport.h | 4 +++- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index fdeac97846..f1cb04eb47 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -1914,7 +1914,7 @@ USBPORT_InitializeTT(IN PDEVICE_OBJECT FdoDevice, TtExtension->RootHubPdo = FdoExtension->RootHubPdo; TtExtension->BusBandwidth = TOTAL_USB11_BUS_BANDWIDTH; - InitializeListHead(&TtExtension->TtList); + InitializeListHead(&TtExtension->EndpointList); /* 90% maximum allowed for periodic endpoints */ for (ix = 0; ix < USB2_FRAMES; ix++) diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index 2479cf9dea..49124ae763 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -471,6 +471,9 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, PUSBPORT_DEVICE_EXTENSION FdoExtension; PUSBPORT_RHDEVICE_EXTENSION PdoExtension; PUSBPORT_ENDPOINT Endpoint; + PUSBPORT_REGISTRATION_PACKET Packet; + PUSB2_TT_EXTENSION TtExtension; + ULONG ix; BOOLEAN IsReady; KIRQL OldIrql; @@ -492,7 +495,6 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, } Endpoint = PipeHandle->Endpoint; - DPRINT("USBPORT_ClosePipe: Endpoint - %p\n", Endpoint); KeAcquireSpinLock(&FdoExtension->EndpointListSpinLock, &OldIrql); @@ -543,16 +545,44 @@ USBPORT_ClosePipe(IN PUSBPORT_DEVICE_HANDLE DeviceHandle, } Endpoint->DeviceHandle = NULL; + Packet = &FdoExtension->MiniPortInterface->Packet; - if (FdoExtension->MiniPortInterface->Packet.MiniPortFlags & USB_MINIPORT_FLAGS_USB2) + if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2) { - DPRINT("USBPORT_ClosePipe: FIXME USBPORT_FreeBandwidthUSB20\n"); - //USBPORT_FreeBandwidthUSB20(); + USBPORT_FreeBandwidthUSB2(FdoDevice, Endpoint); + + KeAcquireSpinLock(&FdoExtension->TtSpinLock, &OldIrql); + + TtExtension = Endpoint->TtExtension; + + if (TtExtension) + { + RemoveEntryList(&Endpoint->TtLink); + + Endpoint->TtLink.Flink = NULL; + Endpoint->TtLink.Blink = NULL; + + if (TtExtension->Flags & USB2_TT_EXTENSION_FLAG_DELETED) + { + if (IsListEmpty(&TtExtension->EndpointList)) + { + USBPORT_UpdateAllocatedBwTt(TtExtension); + + for (ix = 0; ix < USB2_FRAMES; ix++) + { + FdoExtension->Bandwidth[ix] += TtExtension->MaxBandwidth; + } + + ExFreePool(TtExtension); + } + } + } + + KeReleaseSpinLock(&FdoExtension->TtSpinLock, OldIrql); } else { - DPRINT("USBPORT_ClosePipe: FIXME USBPORT_FreeBandwidthUSB11\n"); - //USBPORT_FreeBandwidthUSB11(); + USBPORT_FreeBandwidth(FdoDevice, Endpoint); } KeAcquireSpinLock(&Endpoint->EndpointSpinLock, &Endpoint->EndpointOldIrql); @@ -676,7 +706,7 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, if (DeviceHandle->TtExtension) { - ExInterlockedInsertTailList(&DeviceHandle->TtExtension->TtList, + ExInterlockedInsertTailList(&DeviceHandle->TtExtension->EndpointList, &Endpoint->TtLink, &FdoExtension->TtSpinLock); } diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 2f37634468..3bba591f06 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -528,6 +528,8 @@ typedef struct _USB2_TT { ULONG TimeCS[USB2_FRAMES][USB2_MICROFRAMES]; } USB2_TT, *PUSB2_TT; +#define USB2_TT_EXTENSION_FLAG_DELETED 1 + typedef struct _USB2_TT_EXTENSION { PDEVICE_OBJECT RootHubPdo; ULONG Flags; @@ -537,7 +539,7 @@ typedef struct _USB2_TT_EXTENSION { ULONG MinBandwidth; USHORT DeviceAddress; USHORT TtNumber; - LIST_ENTRY TtList; + LIST_ENTRY EndpointList; LIST_ENTRY Link; USB2_TT Tt; } USB2_TT_EXTENSION, *PUSB2_TT_EXTENSION;
6 years, 9 months
1
0
0
0
15/77: [USBPORT] Initialize FdoExtension->Bandwidth[] in USBPORT_StartDevice().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=7c398f6eb7251c8bb88e5…
commit 7c398f6eb7251c8bb88e50f06aced4b26bc9fdf4 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 20:44:13 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:39 2018 +0100 [USBPORT] Initialize FdoExtension->Bandwidth[] in USBPORT_StartDevice(). --- drivers/usb/usbport/pnp.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/usb/usbport/pnp.c b/drivers/usb/usbport/pnp.c index e7ec3117fc..7b0c5dd20e 100644 --- a/drivers/usb/usbport/pnp.c +++ b/drivers/usb/usbport/pnp.c @@ -519,6 +519,7 @@ USBPORT_StartDevice(IN PDEVICE_OBJECT FdoDevice, BOOLEAN IsCompanion = FALSE; ULONG LegacyBIOS; ULONG MiniportFlags; + ULONG ix; DPRINT("USBPORT_StartDevice: FdoDevice - %p, UsbPortResources - %p\n", FdoDevice, @@ -610,6 +611,7 @@ USBPORT_StartDevice(IN PDEVICE_OBJECT FdoDevice, KeInitializeSpinLock(&FdoExtension->PowerWakeSpinLock); KeInitializeSpinLock(&FdoExtension->SetPowerD0SpinLock); KeInitializeSpinLock(&FdoExtension->RootHubCallbackSpinLock); + KeInitializeSpinLock(&FdoExtension->TtSpinLock); KeInitializeDpc(&FdoExtension->IsrDpc, USBPORT_IsrDpc, FdoDevice); @@ -754,6 +756,12 @@ USBPORT_StartDevice(IN PDEVICE_OBJECT FdoDevice, FdoExtension->TotalBusBandwidth = TotalBusBandwidth; } + for (ix = 0; ix < USB2_FRAMES; ix++) + { + FdoExtension->Bandwidth[ix] = FdoExtension->TotalBusBandwidth - + FdoExtension->TotalBusBandwidth / 10; + } + FdoExtension->ActiveIrpTable = ExAllocatePoolWithTag(NonPagedPool, sizeof(USBPORT_IRP_TABLE), USB_PORT_TAG);
6 years, 9 months
1
0
0
0
14/77: [USBPORT] Add USBPORT_GetTt().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0f8425ed442c604c9f720…
commit 0f8425ed442c604c9f72038e4b10dc9b5c02a397 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 20:35:03 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:39 2018 +0100 [USBPORT] Add USBPORT_GetTt(). --- drivers/usb/usbport/device.c | 70 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index aa70c184cd..fdeac97846 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -885,6 +885,76 @@ USBPORT_AbortTransfers(IN PDEVICE_OBJECT FdoDevice, } } +PUSB2_TT_EXTENSION +NTAPI +USBPORT_GetTt(IN PDEVICE_OBJECT FdoDevice, + IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle, + OUT PUSHORT OutPort, + OUT PUSBPORT_DEVICE_HANDLE * OutHubDeviceHandle) +{ + PUSBPORT_DEVICE_HANDLE DeviceHandle = HubDeviceHandle; + ULONG TtCount; + PLIST_ENTRY Entry; + PUSB2_TT_EXTENSION TtExtension = NULL; + + DPRINT("USBPORT_GetTt: HubDeviceHandle - %p\n", HubDeviceHandle); + + *OutHubDeviceHandle = NULL; + + while (DeviceHandle->DeviceSpeed != UsbHighSpeed) + { + DPRINT("USBPORT_GetTt: DeviceHandle - %p, DeviceHandle->PortNumber - %X\n", + DeviceHandle, + DeviceHandle->PortNumber); + + *OutPort = DeviceHandle->PortNumber; + + DeviceHandle = DeviceHandle->HubDeviceHandle; + + if (!DeviceHandle) + return NULL; + } + + TtCount = DeviceHandle->TtCount; + + if (!TtCount) + return NULL; + + if (IsListEmpty(&DeviceHandle->TtList)) + return NULL; + + Entry = DeviceHandle->TtList.Flink; + + if (TtCount > 1) + { + while (Entry != &DeviceHandle->TtList) + { + ASSERT(Entry != NULL); + + TtExtension = CONTAINING_RECORD(Entry, + USB2_TT_EXTENSION, + Link); + + if (TtExtension->TtNumber == *OutPort) + break; + + Entry = Entry->Flink; + + TtExtension = NULL; + } + } + else + { + TtExtension = CONTAINING_RECORD(Entry, + USB2_TT_EXTENSION, + Link); + } + + *OutHubDeviceHandle = DeviceHandle; + + return TtExtension; +} + NTSTATUS NTAPI USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle,
6 years, 9 months
1
0
0
0
13/77: [USBPORT] Add support for transaction translators in USBPORT_CreateDevice().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c92f591144df00d7bd966…
commit c92f591144df00d7bd9669c817930c2f95d8784a Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 19:29:38 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:39 2018 +0100 [USBPORT] Add support for transaction translators in USBPORT_CreateDevice(). --- drivers/usb/usbport/device.c | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index 268571fd7f..aa70c184cd 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -893,6 +893,9 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, IN USHORT PortStatus, IN USHORT Port) { + PUSBPORT_DEVICE_HANDLE TtDeviceHandle = NULL; + PUSB2_TT_EXTENSION TtExtension = NULL; + USHORT port; PUSBPORT_DEVICE_HANDLE DeviceHandle; PUSBPORT_PIPE_HANDLE PipeHandle; BOOL IsOpenedPipe; @@ -902,7 +905,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, SIZE_T DescriptorMinSize; UCHAR MaxPacketSize; PUSBPORT_DEVICE_EXTENSION FdoExtension; - + PUSBPORT_REGISTRATION_PACKET Packet; NTSTATUS Status; DPRINT("USBPORT_CreateDevice: PortStatus - %p, Port - %x\n", @@ -910,6 +913,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, Port); FdoExtension = FdoDevice->DeviceExtension; + Packet = &FdoExtension->MiniPortInterface->Packet; KeWaitForSingleObject(&FdoExtension->DeviceSemaphore, Executive, @@ -928,11 +932,21 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, return STATUS_DEVICE_NOT_CONNECTED; } - if (FdoExtension->MiniPortInterface->Packet.MiniPortFlags & USB_MINIPORT_FLAGS_USB2 && + port = Port; + + if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2 && !(PortStatus & USB_PORT_STATUS_HIGH_SPEED)) { - DPRINT1("USBPORT_CreateDevice: USB1 device connected to USB2 port. FIXME: Transaction Translator.\n"); - DbgBreakPoint(); + DPRINT1("USBPORT_CreateDevice: USB1 device connected to USB2 port\n"); + + TtExtension = USBPORT_GetTt(FdoDevice, + HubDeviceHandle, + &port, + &TtDeviceHandle); + + DPRINT("USBPORT_CreateDevice: TtDeviceHandle - %p, port - %x\n", + TtDeviceHandle, + port); } KeReleaseSemaphore(&FdoExtension->DeviceSemaphore, @@ -954,6 +968,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, *pUsbdDeviceHandle = NULL; + DeviceHandle->TtExtension = TtExtension; DeviceHandle->PortNumber = Port; DeviceHandle->HubDeviceHandle = HubDeviceHandle; @@ -993,6 +1008,7 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, } InitializeListHead(&DeviceHandle->PipeHandleList); + InitializeListHead(&DeviceHandle->TtList); Status = USBPORT_OpenPipe(FdoDevice, DeviceHandle, @@ -1089,7 +1105,36 @@ USBPORT_CreateDevice(IN OUT PUSB_DEVICE_HANDLE *pUsbdDeviceHandle, ErrorExit: - // FIXME: if Transaction Translator + if (TtExtension && TtDeviceHandle) + { + SetupPacket.bmRequestType.Recipient = BMREQUEST_TO_OTHER; + SetupPacket.bmRequestType.Reserved = 0; + SetupPacket.bmRequestType.Type = BMREQUEST_CLASS; + SetupPacket.bmRequestType.Dir = BMREQUEST_HOST_TO_DEVICE; + + /* Table 11-15. Hub Class Requests */ + if (TtDeviceHandle == HubDeviceHandle) + { + SetupPacket.bRequest = USB_REQUEST_RESET_TT; + } + else + { + SetupPacket.bRequest = USB_REQUEST_CLEAR_TT_BUFFER; + } + + SetupPacket.wValue.LowByte = 0; + SetupPacket.wValue.HiByte = 0; + SetupPacket.wIndex.W = port; + SetupPacket.wLength = 0; + + USBPORT_SendSetupPacket(TtDeviceHandle, + FdoDevice, + &SetupPacket, + NULL, + 0, + NULL, + NULL); + } Status = STATUS_DEVICE_DATA_ERROR;
6 years, 9 months
1
0
0
0
12/77: [USBPORT] Add support for transaction translators in USBPORT_OpenPipe().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3fcbd7744c8e595fb7aec…
commit 3fcbd7744c8e595fb7aecbb066f5e0197ba280e9 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 18:53:46 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:38 2018 +0100 [USBPORT] Add support for transaction translators in USBPORT_OpenPipe(). --- drivers/usb/usbport/endpoint.c | 38 ++++++++++++++++++++++++++++++++++++++ drivers/usb/usbport/usbport.h | 11 +++++++++-- 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/drivers/usb/usbport/endpoint.c b/drivers/usb/usbport/endpoint.c index be2c7eab6d..2479cf9dea 100644 --- a/drivers/usb/usbport/endpoint.c +++ b/drivers/usb/usbport/endpoint.c @@ -672,6 +672,26 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, Endpoint->DeviceHandle = DeviceHandle; Endpoint->LockCounter = -1; + Endpoint->TtExtension = DeviceHandle->TtExtension; + + if (DeviceHandle->TtExtension) + { + ExInterlockedInsertTailList(&DeviceHandle->TtExtension->TtList, + &Endpoint->TtLink, + &FdoExtension->TtSpinLock); + } + + if (Packet->MiniPortFlags & USB_MINIPORT_FLAGS_USB2) + { + Endpoint->TtEndpoint = (PUSB2_TT_ENDPOINT)((ULONG_PTR)Endpoint + + sizeof(USBPORT_ENDPOINT) + + Packet->MiniPortEndpointSize); + } + else + { + Endpoint->TtEndpoint = NULL; + } + KeInitializeSpinLock(&Endpoint->EndpointSpinLock); KeInitializeSpinLock(&Endpoint->StateChangeSpinLock); @@ -695,6 +715,17 @@ USBPORT_OpenPipe(IN PDEVICE_OBJECT FdoDevice, EndpointProperties->TotalMaxPacketSize = MaxPacketSize * (AdditionalTransaction + 1); + if (Endpoint->TtExtension) + { + EndpointProperties->HubAddr = Endpoint->TtExtension->DeviceAddress; + } + else + { + EndpointProperties->HubAddr = -1; + } + + EndpointProperties->PortNumber = DeviceHandle->PortNumber; + switch (EndpointDescriptor->bmAttributes & USB_ENDPOINT_TYPE_MASK) { case USB_ENDPOINT_TYPE_CONTROL: @@ -960,6 +991,13 @@ ExitWithError: } } + if (Endpoint->TtExtension) + { + KeAcquireSpinLock(&FdoExtension->TtSpinLock, &OldIrql); + RemoveEntryList(&Endpoint->TtLink); + KeReleaseSpinLock(&FdoExtension->TtSpinLock, OldIrql); + } + ExFreePoolWithTag(Endpoint, USB_PORT_TAG); } diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 85636b24bf..2f37634468 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -154,7 +154,9 @@ typedef struct _USBPORT_COMMON_BUFFER_HEADER { typedef struct _USBPORT_ENDPOINT *PUSBPORT_ENDPOINT; typedef struct _USB2_HC_EXTENSION *PUSB2_HC_EXTENSION; +typedef struct _USB2_TT_EXTENSION *PUSB2_TT_EXTENSION; typedef struct _USB2_TT *PUSB2_TT; +typedef struct _USB2_TT_ENDPOINT *PUSB2_TT_ENDPOINT; typedef struct _USBPORT_PIPE_HANDLE { ULONG Flags; @@ -194,6 +196,7 @@ typedef struct _USBPORT_DEVICE_HANDLE { LIST_ENTRY DeviceHandleLink; LONG DeviceHandleLock; ULONG TtCount; + PUSB2_TT_EXTENSION TtExtension; // Transaction Translator LIST_ENTRY TtList; } USBPORT_DEVICE_HANDLE, *PUSBPORT_DEVICE_HANDLE; @@ -202,6 +205,8 @@ typedef struct _USBPORT_ENDPOINT { PDEVICE_OBJECT FdoDevice; PUSBPORT_COMMON_BUFFER_HEADER HeaderBuffer; PUSBPORT_DEVICE_HANDLE DeviceHandle; + PUSB2_TT_EXTENSION TtExtension; // Transaction Translator + PUSB2_TT_ENDPOINT TtEndpoint; USBPORT_ENDPOINT_PROPERTIES EndpointProperties; ULONG EndpointWorker; ULONG FrameNumber; @@ -230,6 +235,7 @@ typedef struct _USBPORT_ENDPOINT { LIST_ENTRY FlushLink; LIST_ENTRY FlushControllerLink; LIST_ENTRY FlushAbortLink; + LIST_ENTRY TtLink; } USBPORT_ENDPOINT, *PUSBPORT_ENDPOINT; typedef struct _USBPORT_ISO_BLOCK *PUSBPORT_ISO_BLOCK; @@ -381,10 +387,11 @@ typedef struct _USBPORT_DEVICE_EXTENSION { /* Usb 2.0 HC Extension */ PUSB2_HC_EXTENSION Usb2Extension; ULONG Bandwidth[32]; + KSPIN_LOCK TtSpinLock; /* Miniport extension should be aligned on 0x100 */ #if !defined(_M_X64) - ULONG Padded[1]; + ULONG Padded[64]; #else ULONG Padded[0]; #endif @@ -392,7 +399,7 @@ typedef struct _USBPORT_DEVICE_EXTENSION { } USBPORT_DEVICE_EXTENSION, *PUSBPORT_DEVICE_EXTENSION; #if !defined(_M_X64) -C_ASSERT(sizeof(USBPORT_DEVICE_EXTENSION) == 0x400); +C_ASSERT(sizeof(USBPORT_DEVICE_EXTENSION) == 0x500); #else C_ASSERT(sizeof(USBPORT_DEVICE_EXTENSION) == 0x600); #endif
6 years, 9 months
1
0
0
0
11/77: [USBPORT] Add USBPORT_UpdateAllocatedBwTt().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=e48d6136ec9984305a444…
commit e48d6136ec9984305a444f62968431fa5b2afe1d Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 18:30:58 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:38 2018 +0100 [USBPORT] Add USBPORT_UpdateAllocatedBwTt(). --- drivers/usb/usbport/usb2.c | 34 ++++++++++++++++++++++++++++++++++ drivers/usb/usbport/usbport.h | 5 +++++ 2 files changed, 39 insertions(+) diff --git a/drivers/usb/usbport/usb2.c b/drivers/usb/usbport/usb2.c index 1c4cd042de..2e511b5d9a 100644 --- a/drivers/usb/usbport/usb2.c +++ b/drivers/usb/usbport/usb2.c @@ -31,6 +31,40 @@ USB2_InitTtEndpoint(IN PUSB2_TT_ENDPOINT TtEndpoint, TtEndpoint->Tt = Tt; } +VOID +NTAPI +USBPORT_UpdateAllocatedBwTt(IN PUSB2_TT_EXTENSION TtExtension) +{ + ULONG BusBandwidth; + ULONG NewBusBandwidth; + ULONG MaxBusBandwidth = 0; + ULONG MinBusBandwidth; + ULONG ix; + + DPRINT("USBPORT_UpdateAllocatedBwTt: TtExtension - %p\n", TtExtension); + + BusBandwidth = TtExtension->BusBandwidth; + MinBusBandwidth = BusBandwidth; + + for (ix = 0; ix < USB2_FRAMES; ix++) + { + NewBusBandwidth = BusBandwidth - TtExtension->Bandwidth[ix]; + + if (NewBusBandwidth > MaxBusBandwidth) + MaxBusBandwidth = NewBusBandwidth; + + if (NewBusBandwidth < MinBusBandwidth) + MinBusBandwidth = NewBusBandwidth; + } + + TtExtension->MaxBandwidth = MaxBusBandwidth; + + if (MinBusBandwidth == BusBandwidth) + TtExtension->MinBandwidth = 0; + else + TtExtension->MinBandwidth = MinBusBandwidth; +} + BOOLEAN NTAPI USBPORT_AllocateBandwidthUSB2(IN PDEVICE_OBJECT FdoDevice, diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 026b297f17..85636b24bf 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -1296,6 +1296,11 @@ USBPORT_FreeBandwidthUSB2( IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint); +VOID +NTAPI +USBPORT_UpdateAllocatedBwTt( + IN PUSB2_TT_EXTENSION TtExtension); + VOID NTAPI USB2_InitTT(
6 years, 9 months
1
0
0
0
10/77: [USBPORT] Implement USBPORT_InitializeTT().
by Vadim Galyant
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=18702047a16f49053de45…
commit 18702047a16f49053de4597a56879edb357a3a24 Author: Vadim Galyant <vgal(a)rambler.ru> AuthorDate: Mon Nov 27 18:20:28 2017 +0900 Commit: Amine Khaldi <amine.khaldi(a)reactos.org> CommitDate: Sun Jan 21 19:35:38 2018 +0100 [USBPORT] Implement USBPORT_InitializeTT(). --- drivers/usb/usbport/device.c | 52 +++++++++++++++++++++++++++++++++++++++++-- drivers/usb/usbport/usbport.h | 10 ++++++++- 2 files changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/usb/usbport/device.c b/drivers/usb/usbport/device.c index f7180aaf96..268571fd7f 100644 --- a/drivers/usb/usbport/device.c +++ b/drivers/usb/usbport/device.c @@ -1770,7 +1770,55 @@ USBPORT_InitializeTT(IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_DEVICE_HANDLE HubDeviceHandle, IN ULONG TtNumber) { - DPRINT1("USBPORT_InitializeTT: UNIMPLEMENTED. FIXME. \n"); + PUSBPORT_DEVICE_EXTENSION FdoExtension; + PUSB2_TT_EXTENSION TtExtension; + ULONG ix; + + DPRINT("USBPORT_InitializeTT: HubDeviceHandle - %p, TtNumber - %X\n", + HubDeviceHandle, + TtNumber); + + FdoExtension = FdoDevice->DeviceExtension; + + TtExtension = ExAllocatePoolWithTag(NonPagedPool, + sizeof(USB2_TT_EXTENSION), + USB_PORT_TAG); + + if (!TtExtension) + { + DPRINT1("USBPORT_InitializeTT: ExAllocatePoolWithTag return NULL\n"); + return STATUS_INSUFFICIENT_RESOURCES; + } + + DPRINT("USBPORT_InitializeTT: TtExtension - %p\n", TtExtension); + + RtlZeroMemory(TtExtension, sizeof(USB2_TT_EXTENSION)); + + TtExtension->DeviceAddress = HubDeviceHandle->DeviceAddress; + TtExtension->TtNumber = TtNumber; + TtExtension->RootHubPdo = FdoExtension->RootHubPdo; + TtExtension->BusBandwidth = TOTAL_USB11_BUS_BANDWIDTH; + + InitializeListHead(&TtExtension->TtList); + + /* 90% maximum allowed for periodic endpoints */ + for (ix = 0; ix < USB2_FRAMES; ix++) + { + TtExtension->Bandwidth[ix] = TtExtension->BusBandwidth - + TtExtension->BusBandwidth / 10; + } + + USBPORT_UpdateAllocatedBwTt(TtExtension); + + for (ix = 0; ix < USB2_FRAMES; ix++) + { + FdoExtension->Bandwidth[ix] -= TtExtension->MaxBandwidth; + } + + USB2_InitTT(FdoExtension->Usb2Extension, &TtExtension->Tt); + + InsertTailList(&HubDeviceHandle->TtList, &TtExtension->Link); + return STATUS_SUCCESS; } @@ -1783,7 +1831,7 @@ USBPORT_Initialize20Hub(IN PDEVICE_OBJECT FdoDevice, NTSTATUS Status; ULONG ix; - DPRINT("USBPORT_Initialize20Hub \n"); + DPRINT("USBPORT_Initialize20Hub: TtCount - %X\n", TtCount); if (!HubDeviceHandle) { diff --git a/drivers/usb/usbport/usbport.h b/drivers/usb/usbport/usbport.h index 93c71a9516..026b297f17 100644 --- a/drivers/usb/usbport/usbport.h +++ b/drivers/usb/usbport/usbport.h @@ -194,6 +194,7 @@ typedef struct _USBPORT_DEVICE_HANDLE { LIST_ENTRY DeviceHandleLink; LONG DeviceHandleLock; ULONG TtCount; + LIST_ENTRY TtList; } USBPORT_DEVICE_HANDLE, *PUSBPORT_DEVICE_HANDLE; typedef struct _USBPORT_ENDPOINT { @@ -379,10 +380,11 @@ typedef struct _USBPORT_DEVICE_EXTENSION { KDPC HcWakeDpc; /* Usb 2.0 HC Extension */ PUSB2_HC_EXTENSION Usb2Extension; + ULONG Bandwidth[32]; /* Miniport extension should be aligned on 0x100 */ #if !defined(_M_X64) - ULONG Padded[33]; + ULONG Padded[1]; #else ULONG Padded[0]; #endif @@ -1294,6 +1296,12 @@ USBPORT_FreeBandwidthUSB2( IN PDEVICE_OBJECT FdoDevice, IN PUSBPORT_ENDPOINT Endpoint); +VOID +NTAPI +USB2_InitTT( + IN PUSB2_HC_EXTENSION HcExtension, + IN PUSB2_TT Tt); + VOID NTAPI USB2_InitController(
6 years, 9 months
1
0
0
0
← Newer
1
...
5
6
7
8
9
10
11
...
44
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
Results per page:
10
25
50
100
200