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
February 2012
----- 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
22 participants
577 discussions
Start a n
N
ew thread
[tkreuzer] 55496: [HAL] Fix syntax, patch by Victor Martinez
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 8 18:29:08 2012 New Revision: 55496 URL:
http://svn.reactos.org/svn/reactos?rev=55496&view=rev
Log: [HAL] Fix syntax, patch by Victor Martinez Modified: trunk/reactos/hal/halx86/up/pic.c Modified: trunk/reactos/hal/halx86/up/pic.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/pic.c?rev=55…
============================================================================== --- trunk/reactos/hal/halx86/up/pic.c [iso-8859-1] (original) +++ trunk/reactos/hal/halx86/up/pic.c [iso-8859-1] Wed Feb 8 18:29:08 2012 @@ -104,7 +104,7 @@ 0b00000000000000000000000000000000, /* IRQL 1 */ 0b00000000000000000000000000000000, /* IRQL 2 */ 0b00000000000000000000000000000000, /* IRQL 3 */ - + /* * These next IRQLs are actually useless from the PIC perspective, because * with only 2 PICs, the mask you can send them is only 8 bits each, for 16 @@ -118,7 +118,7 @@ 0b11111111111111000000000000000000, /* IRQL 9 */ 0b11111111111111100000000000000000, /* IRQL 10 */ 0b11111111111111110000000000000000, /* IRQL 11 */ - + /* * Okay, now we're finally starting to mask off IRQs on the slave PIC, from * IRQ15 to IRQ8. This means the higher-level IRQs get less priority in the @@ -132,7 +132,7 @@ 0b11111111111111111111110000000000, /* IRQL 17 */ 0b11111111111111111111111000000000, /* IRQL 18 */ 0b11111111111111111111111000000000, /* IRQL 19 */ - + /* * Now we mask off the IRQs on the master. Notice the 0 "droplet"? You might * have also seen that IRQL 18 and 19 are essentially equal as far as the @@ -149,7 +149,7 @@ 0b11111111111111111111111011111000, /* IRQL 25 */ 0b11111111111111111111111011111010, /* IRQL 26 */ 0b11111111111111111111111111111010, /* IRQL 27 */ - + /* * IRQL 24 and 25 are actually identical, so IRQL 28 is actually the last * IRQL to modify a bit on the master PIC. It happens to modify the very @@ -160,7 +160,7 @@ * called CLOCK2_LEVEL, which explains the usage we just explained. */ 0b11111111111111111111111111111011, /* IRQL 28 */ - + /* * We have finished off with the PIC so there's nothing left to mask at the * level of these IRQLs, making them only logical IRQLs on x86 machines. @@ -221,13 +221,13 @@ 0b11111111111111111111111111111110, /* IRQL 0 */ 0b11111111111111111111111111111100, /* IRQL 1 */ 0b11111111111111111111111111111000, /* IRQL 2 */ - + /* * IRQL3 means only hardware IRQLs can now preempt. These last 4 zeros will * then continue throughout the rest of the list, trickling down. */ 0b11111111111111111111111111110000, /* IRQL 3 */ - + /* * Just like in the previous list, these masks don't really mean anything * since we've only got two PICs with 16 possible IRQs total @@ -239,7 +239,7 @@ 0b00000000011111111111111111110000, /* IRQL 8 */ 0b00000000001111111111111111110000, /* IRQL 9 */ 0b00000000000111111111111111110000, /* IRQL 10 */ - + /* * Now we start progressivly limiting which slave PIC interrupts have the * right to preempt us at each level. @@ -253,7 +253,7 @@ 0b00000000000000000011111111110000, /* IRQL 17 */ 0b00000000000000000001111111110000, /* IRQL 18 */ 0b00000000000000000001111111110000, /* IRQL 19 */ - + /* * Also recall from the earlier table that IRQL 18/19 are treated the same * in order to spread the masks better thoughout the 32 IRQLs and to reflect @@ -269,15 +269,15 @@ 0b00000000000000000001000001110000, /* IRQL 24 */ 0b00000000000000000001000000110000, /* IRQL 25 */ 0b00000000000000000001000000010000, /* IRQL 26 */ - + /* At this point, only the clock (IRQ0) can still preempt... */ 0b00000000000000000000000000010000, /* IRQL 27 */ - + /* And any higher than that there's no relation with hardware PICs anymore */ 0b00000000000000000000000000000000, /* IRQL 28 */ 0b00000000000000000000000000000000, /* IRQL 29 */ 0b00000000000000000000000000000000, /* IRQL 30 */ - 0b00000000000000000000000000000000, /* IRQL 31 */ + 0b00000000000000000000000000000000 /* IRQL 31 */ #else 0xFFFFFFFE, /* IRQL 0 */ 0xFFFFFFFC, /* IRQL 1 */ @@ -420,11 +420,11 @@ I8259_ICW4 Icw4; EISA_ELCR Elcr; ULONG i, j; - + /* Save EFlags and disable interrupts */ EFlags = __readeflags(); _disable(); - + /* Initialize ICW1 for master, interval 8, edge-triggered mode with ICW4 */ Icw1.NeedIcw4 = TRUE; Icw1.InterruptMode = EdgeTriggered; @@ -433,16 +433,16 @@ Icw1.Init = TRUE; Icw1.InterruptVectorAddress = 0; /* This is only used in MCS80/85 mode */ __outbyte(PIC1_CONTROL_PORT, Icw1.Bits); - + /* Set interrupt vector base */ Icw2.Bits = PRIMARY_VECTOR_BASE; __outbyte(PIC1_DATA_PORT, Icw2.Bits); - + /* Connect slave to IRQ 2 */ Icw3.Bits = 0; Icw3.SlaveIrq2 = TRUE; __outbyte(PIC1_DATA_PORT, Icw3.Bits); - + /* Enable 8086 mode, non-automatic EOI, non-buffered mode, non special fully nested mode */ Icw4.Reserved = 0; Icw4.SystemMode = New8086Mode; @@ -450,10 +450,10 @@ Icw4.BufferedMode = NonBuffered; Icw4.SpecialFullyNestedMode = FALSE; __outbyte(PIC1_DATA_PORT, Icw4.Bits); - + /* Mask all interrupts */ __outbyte(PIC1_DATA_PORT, 0xFF); - + /* Initialize ICW1 for master, interval 8, edge-triggered mode with ICW4 */ Icw1.NeedIcw4 = TRUE; Icw1.InterruptMode = EdgeTriggered; @@ -462,16 +462,16 @@ Icw1.Init = TRUE; Icw1.InterruptVectorAddress = 0; /* This is only used in MCS80/85 mode */ __outbyte(PIC2_CONTROL_PORT, Icw1.Bits); - + /* Set interrupt vector base */ Icw2.Bits = PRIMARY_VECTOR_BASE + 8; __outbyte(PIC2_DATA_PORT, Icw2.Bits); - + /* Slave ID */ Icw3.Bits = 0; Icw3.SlaveId = 2; __outbyte(PIC2_DATA_PORT, Icw3.Bits); - + /* Enable 8086 mode, non-automatic EOI, non-buffered mode, non special fully nested mode */ Icw4.Reserved = 0; Icw4.SystemMode = New8086Mode; @@ -479,20 +479,20 @@ Icw4.BufferedMode = NonBuffered; Icw4.SpecialFullyNestedMode = FALSE; __outbyte(PIC2_DATA_PORT, Icw4.Bits); - + /* Mask all interrupts */ __outbyte(PIC2_DATA_PORT, 0xFF); - + /* Read EISA Edge/Level Register for master and slave */ Elcr.Bits = (__inbyte(EISA_ELCR_SLAVE) << 8) | __inbyte(EISA_ELCR_MASTER); - + /* IRQs 0, 1, 2, 8, and 13 are system-reserved and must be edge */ if (!(Elcr.Master.Irq0Level) && !(Elcr.Master.Irq1Level) && !(Elcr.Master.Irq2Level) && !(Elcr.Slave.Irq8Level) && !(Elcr.Slave.Irq13Level)) { /* ELCR is as it's supposed to be, save it */ HalpEisaELCR = Elcr.Bits; - + /* Scan for level interrupts */ for (i = 1, j = 0; j < 16; i <<= 1, j++) { @@ -506,7 +506,7 @@ } } } - + /* Register IRQ 2 */ HalpRegisterVector(IDT_INTERNAL, PRIMARY_VECTOR_BASE + 2, @@ -561,11 +561,11 @@ { PKPCR Pcr = KeGetPcr(); KIRQL CurrentIrql; - + /* Save and update IRQL */ CurrentIrql = Pcr->Irql; Pcr->Irql = DISPATCH_LEVEL; - + #if DBG /* Validate correct raise */ if (CurrentIrql > DISPATCH_LEVEL) KeBugCheck(IRQL_NOT_GREATER_OR_EQUAL); @@ -584,11 +584,11 @@ { PKPCR Pcr = KeGetPcr(); KIRQL CurrentIrql; - + /* Save and update IRQL */ CurrentIrql = Pcr->Irql; Pcr->Irql = SYNCH_LEVEL; - + #if DBG /* Validate correct raise */ if (CurrentIrql > SYNCH_LEVEL) @@ -618,7 +618,7 @@ /* Read current IRQL */ CurrentIrql = Pcr->Irql; - + #if DBG /* Validate correct raise */ if (CurrentIrql > NewIrql) @@ -631,7 +631,7 @@ /* Set new IRQL */ Pcr->Irql = NewIrql; - + /* Return old IRQL */ return CurrentIrql; } @@ -648,7 +648,7 @@ ULONG PendingIrql, PendingIrqlMask; PKPCR Pcr = KeGetPcr(); PIC_MASK Mask; - + #if DBG /* Validate correct lower */ if (OldIrql > Pcr->Irql) @@ -658,7 +658,7 @@ KeBugCheck(IRQL_NOT_LESS_OR_EQUAL); } #endif - + /* Save EFlags and disable interrupts */ EFlags = __readeflags(); _disable(); @@ -707,18 +707,18 @@ ULONG EFlags; PKPCR Pcr = KeGetPcr(); KIRQL PendingIrql; - + /* Save EFlags and disable interrupts */ EFlags = __readeflags(); _disable(); - + /* Mask out the requested bit */ Pcr->IRR |= (1 << Irql); /* Check for pending software interrupts and compare with current IRQL */ PendingIrql = SWInterruptLookUpTable[Pcr->IRR & 3]; if (PendingIrql > Pcr->Irql) SWInterruptHandlerTable[PendingIrql](); - + /* Restore interrupt state */ __writeeflags(EFlags); } @@ -752,10 +752,10 @@ /* Check for pending software interrupts and compare with current IRQL */ PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[OldIrql]; if (!PendingIrqlMask) return; - + /* Check for in-service delayed interrupt */ if (Pcr->IrrActive & 0xFFFFFFF0) return; - + /* Check if pending IRQL affects hardware state */ BitScanReverse(&PendingIrql, PendingIrqlMask); if (PendingIrql > DISPATCH_LEVEL) @@ -769,10 +769,10 @@ PendingIrqMask = (1 << PendingIrql); Pcr->IrrActive |= PendingIrqMask; Pcr->IRR ^= PendingIrqMask; - + /* Handle delayed hardware interrupt */ SWInterruptHandlerTable[PendingIrql](); - + /* Handling complete */ Pcr->IrrActive ^= PendingIrqMask; } @@ -799,14 +799,14 @@ /* First save current IRQL and compare it to the requested one */ CurrentIrql = Pcr->Irql; - + /* Check if this interrupt is really allowed to happen */ if (Irql > CurrentIrql) { /* Set the new IRQL and return the current one */ Pcr->Irql = Irql; *OldIrql = CurrentIrql; - + /* Prepare OCW2 for EOI */ Ocw2.Bits = 0; Ocw2.EoiMode = SpecificEoi; @@ -816,7 +816,7 @@ { /* Send the EOI for the IRQ */ __outbyte(PIC2_CONTROL_PORT, Ocw2.Bits | ((Irq - 8) & 0xFF)); - + /* Send the EOI for IRQ2 on the master because this was cascaded */ __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | 2); } @@ -825,20 +825,20 @@ /* Send the EOI for the IRQ */ __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | (Irq &0xFF)); } - + /* Enable interrupts and return success */ _enable(); return TRUE; } - + /* Update the IRR so that we deliver this interrupt when the IRQL is proper */ Pcr->IRR |= (1 << (Irq + 4)); - + /* Set new PIC mask to real IRQL level, since the optimization is lost now */ Mask.Both = (KiI8259MaskTable[CurrentIrql] | Pcr->IDR) & 0xFFFF; __outbyte(PIC1_DATA_PORT, Mask.Master); __outbyte(PIC2_DATA_PORT, Mask.Slave); - + /* Now lie and say this was spurious */ return FALSE; } @@ -862,16 +862,16 @@ I8259_OCW3 Ocw3; I8259_OCW2 Ocw2; I8259_ISR Isr; - + /* Request the ISR */ Ocw3.Bits = 0; Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */ Ocw3.ReadRequest = ReadIsr; __outbyte(PIC2_CONTROL_PORT, Ocw3.Bits); - + /* Read the ISR */ Isr.Bits = __inbyte(PIC2_CONTROL_PORT); - + /* Is IRQ15 really active (this is IR7) */ if (Isr.Irq7 == FALSE) { @@ -879,7 +879,7 @@ Ocw2.Bits = 0; Ocw2.EoiMode = SpecificEoi; __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | 2); - + /* And now fail since this was spurious */ return FALSE; } @@ -897,7 +897,7 @@ { /* Clear the FPU busy latch */ __outbyte(0xF0, 0); - + /* Do normal interrupt dismiss */ return _HalpDismissIrqGeneric(Irql, Irq, OldIrql); } @@ -910,19 +910,19 @@ { I8259_OCW3 Ocw3; I8259_ISR Isr; - + /* Request the ISR */ Ocw3.Bits = 0; Ocw3.Sbo = 1; Ocw3.ReadRequest = ReadIsr; __outbyte(PIC1_CONTROL_PORT, Ocw3.Bits); - + /* Read the ISR */ Isr.Bits = __inbyte(PIC1_CONTROL_PORT); - + /* Is IRQ 7 really active? If it isn't, this is spurious so fail */ if (Isr.Irq7 == FALSE) return FALSE; - + /* Do normal interrupt dismiss */ return _HalpDismissIrqGeneric(Irql, Irq, OldIrql); } @@ -944,13 +944,13 @@ Mask.Both = (KiI8259MaskTable[Irql] | Pcr->IDR) & 0xFFFF; __outbyte(PIC1_DATA_PORT, Mask.Master); __outbyte(PIC2_DATA_PORT, Mask.Slave); - + /* Update the IRR so that we clear this interrupt when the IRQL is proper */ Pcr->IRR |= (1 << (Irq + 4)); - + /* Save current IRQL */ CurrentIrql = Pcr->Irql; - + /* Prepare OCW2 for EOI */ Ocw2.Bits = 0; Ocw2.EoiMode = SpecificEoi; @@ -976,12 +976,12 @@ /* Set the new IRQL and return the current one */ Pcr->Irql = Irql; *OldIrql = CurrentIrql; - + /* Enable interrupts and return success */ _enable(); return TRUE; } - + /* Now lie and say this was spurious */ return FALSE; } @@ -1005,16 +1005,16 @@ I8259_OCW3 Ocw3; I8259_OCW2 Ocw2; I8259_ISR Isr; - + /* Request the ISR */ Ocw3.Bits = 0; Ocw3.Sbo = 1; /* This encodes an OCW3 vs. an OCW2 */ Ocw3.ReadRequest = ReadIsr; __outbyte(PIC2_CONTROL_PORT, Ocw3.Bits); - + /* Read the ISR */ Isr.Bits = __inbyte(PIC2_CONTROL_PORT); - + /* Is IRQ15 really active (this is IR7) */ if (Isr.Irq7 == FALSE) { @@ -1022,7 +1022,7 @@ Ocw2.Bits = 0; Ocw2.EoiMode = SpecificEoi; __outbyte(PIC1_CONTROL_PORT, Ocw2.Bits | 2); - + /* And now fail since this was spurious */ return FALSE; } @@ -1039,7 +1039,7 @@ { /* Clear the FPU busy latch */ __outbyte(0xF0, 0); - + /* Do normal interrupt dismiss */ return _HalpDismissIrqLevel(Irql, Irq, OldIrql); } @@ -1052,19 +1052,19 @@ { I8259_OCW3 Ocw3; I8259_ISR Isr; - + /* Request the ISR */ Ocw3.Bits = 0; Ocw3.Sbo = 1; Ocw3.ReadRequest = ReadIsr; __outbyte(PIC1_CONTROL_PORT, Ocw3.Bits); - + /* Read the ISR */ Isr.Bits = __inbyte(PIC1_CONTROL_PORT); - + /* Is IRQ 7 really active? If it isn't, this is spurious so fail */ if (Isr.Irq7 == FALSE) return FALSE; - + /* Do normal interrupt dismiss */ return _HalpDismissIrqLevel(Irql, Irq, OldIrql); } @@ -1074,17 +1074,17 @@ { PKPCR Pcr = KeGetPcr(); ULONG PendingIrqlMask, PendingIrql; - + /* Check for pending software interrupts and compare with current IRQL */ PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[Pcr->Irql]; if (PendingIrqlMask) { /* Check for in-service delayed interrupt */ if (Pcr->IrrActive & 0xFFFFFFF0) return; - + /* Check if pending IRQL affects hardware state */ BitScanReverse(&PendingIrql, PendingIrqlMask); - + /* Clear IRR bit */ Pcr->IRR ^= (1 << PendingIrql); @@ -1107,24 +1107,24 @@ ULONG Irq; PKPCR Pcr = KeGetPcr(); PIC_MASK PicMask; - + /* Validate the IRQ */ Irq = Vector - PRIMARY_VECTOR_BASE; if (Irq >= CLOCK2_LEVEL) return FALSE; - + /* Check for level interrupt */ if (InterruptMode == LevelSensitive) { /* Switch handler to level */ SWInterruptHandlerTable[Irq + 4] = HalpHardwareInterruptLevel; - + /* Switch dismiss to level */ HalpSpecialDismissTable[Irq] = HalpSpecialDismissLevelTable[Irq]; } - + /* Disable interrupts */ _disable(); - + /* Update software IDR */ Pcr->IDR &= ~(1 << Irq); @@ -1132,7 +1132,7 @@ PicMask.Both = (KiI8259MaskTable[Pcr->Irql] | Pcr->IDR) & 0xFFFF; __outbyte(PIC1_DATA_PORT, PicMask.Master); __outbyte(PIC2_DATA_PORT, PicMask.Slave); - + /* Enable interrupts and exit */ _enable(); return TRUE; @@ -1151,24 +1151,24 @@ /* Compute new combined IRQ mask */ IrqMask = 1 << (Vector - PRIMARY_VECTOR_BASE); - + /* Disable interrupts */ _disable(); - + /* Update software IDR */ KeGetPcr()->IDR |= IrqMask; - + /* Read current interrupt mask */ PicMask.Master = __inbyte(PIC1_DATA_PORT); PicMask.Slave = __inbyte(PIC2_DATA_PORT); - + /* Add the new disabled interrupt */ PicMask.Both |= IrqMask; - + /* Write new interrupt mask */ __outbyte(PIC1_DATA_PORT, PicMask.Master); __outbyte(PIC2_DATA_PORT, PicMask.Slave); - + /* Bring interrupts back */ _enable(); } @@ -1183,7 +1183,7 @@ OUT PKIRQL OldIrql) { ULONG Irq; - + /* Get the IRQ and call the proper routine to handle it */ Irq = Vector - PRIMARY_VECTOR_BASE; return HalpSpecialDismissTable[Irq](Irql, Irq, OldIrql); @@ -1210,7 +1210,7 @@ { /* Check for in-service delayed interrupt */ if (Pcr->IrrActive & 0xFFFFFFF0) return; - + /* Loop checking for pending interrupts */ while (TRUE) { @@ -1222,21 +1222,21 @@ Mask.Both = Pcr->IDR & 0xFFFF; __outbyte(PIC1_DATA_PORT, Mask.Master); __outbyte(PIC2_DATA_PORT, Mask.Slave); - + /* Now check if this specific interrupt is already in-service */ PendingIrqMask = (1 << PendingIrql); if (Pcr->IrrActive & PendingIrqMask) return; - + /* Set active bit otherwise, and clear it from IRR */ Pcr->IrrActive |= PendingIrqMask; Pcr->IRR ^= PendingIrqMask; - + /* Handle delayed hardware interrupt */ SWInterruptHandlerTable[PendingIrql](); - + /* Handling complete */ Pcr->IrrActive ^= PendingIrqMask; - + /* Check if there's still interrupts pending */ PendingIrqlMask = Pcr->IRR & FindHigherIrqlMask[Pcr->Irql]; if (!PendingIrqlMask) break; @@ -1259,7 +1259,7 @@ { KIRQL CurrentIrql; PKPCR Pcr = KeGetPcr(); - + /* Save the current IRQL and update it */ CurrentIrql = Pcr->Irql; Pcr->Irql = APC_LEVEL; @@ -1300,10 +1300,10 @@ TrapFrame->EFlags = __readeflags(); TrapFrame->SegCs = KGDT_R0_CODE; TrapFrame->Eip = TrapFrame->Eax; - + /* Build the trap frame */ KiEnterInterruptTrap(TrapFrame); - + /* Do the work */ _HalpApcInterruptHandler(TrapFrame); } @@ -1314,19 +1314,19 @@ { KIRQL CurrentIrql; PKPCR Pcr = KeGetPcr(); - + /* Save the current IRQL and update it */ CurrentIrql = Pcr->Irql; Pcr->Irql = DISPATCH_LEVEL; - + /* Remove DPC from IRR */ Pcr->IRR &= ~(1 << DISPATCH_LEVEL); - + /* Enable interrupts and call the kernel's DPC interrupt handler */ _enable(); KiDispatchInterrupt(); _disable(); - + /* Return IRQL */ return CurrentIrql; } @@ -1337,13 +1337,13 @@ HalpDispatchInterrupt2ndEntry(IN PKTRAP_FRAME TrapFrame) { KIRQL CurrentIrql; - + /* Do the work */ CurrentIrql = _HalpDispatchInterruptHandler(); - + /* End the interrupt */ HalpEndSoftwareInterrupt(CurrentIrql, TrapFrame); - + /* Exit the interrupt */ KiEoiHelper(TrapFrame); } @@ -1358,7 +1358,7 @@ /* Do the work */ OldIrql = _HalpDispatchInterruptHandler(); - + /* Restore IRQL */ Pcr->Irql = OldIrql; @@ -1374,7 +1374,7 @@ Mask.Both = Pcr->IDR & 0xFFFF; __outbyte(PIC1_DATA_PORT, Mask.Master); __outbyte(PIC2_DATA_PORT, Mask.Slave); - + /* Clear IRR bit */ Pcr->IRR ^= (1 << PendingIrql); }
12 years, 10 months
1
0
0
0
[tkreuzer] 55495: [ATL] Fix an MSVC warning
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 8 17:16:00 2012 New Revision: 55495 URL:
http://svn.reactos.org/svn/reactos?rev=55495&view=rev
Log: [ATL] Fix an MSVC warning Modified: trunk/reactos/lib/atl/statreg.h Modified: trunk/reactos/lib/atl/statreg.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/atl/statreg.h?rev=5549…
============================================================================== --- trunk/reactos/lib/atl/statreg.h [iso-8859-1] (original) +++ trunk/reactos/lib/atl/statreg.h [iso-8859-1] Wed Feb 8 17:16:00 2012 @@ -470,7 +470,7 @@ return S_OK; } - inline unsigned int HexToBin(char a) + inline unsigned int HexToBin(OLECHAR a) { if (a >= '0' && a <= '9') return a - '0'; @@ -489,14 +489,14 @@ LONG lres; HKEY hkey; strbuf name; - + enum { NORMAL, NO_REMOVE, IS_VAL, FORCE_REMOVE, DO_DELETE - } key_type = NORMAL; + } key_type = NORMAL; static const wchar_t *wstrNoRemove = _T("NoRemove"); static const wchar_t *wstrForceRemove = _T("ForceRemove"); @@ -531,7 +531,7 @@ if (FAILED(hres)) break; } - + if (do_register) { if (key_type == IS_VAL) @@ -676,7 +676,7 @@ RegCloseKey(hkey); hkey = 0; name.len = 0; - + hres = get_word(&iter, buf); if (FAILED(hres)) break;
12 years, 10 months
1
0
0
0
[tkreuzer] 55494: [NDK] Add definition of PWOW64_CONTEXT
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Wed Feb 8 16:25:13 2012 New Revision: 55494 URL:
http://svn.reactos.org/svn/reactos?rev=55494&view=rev
Log: [NDK] Add definition of PWOW64_CONTEXT Modified: trunk/reactos/include/ndk/rtlfuncs.h Modified: trunk/reactos/include/ndk/rtlfuncs.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
============================================================================== --- trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] (original) +++ trunk/reactos/include/ndk/rtlfuncs.h [iso-8859-1] Wed Feb 8 16:25:13 2012 @@ -2332,6 +2332,8 @@ ); #ifdef _M_AMD64 +typedef struct _WOW64_CONTEXT *PWOW64_CONTEXT; + NTSYSAPI NTSTATUS NTAPI
12 years, 10 months
1
0
0
0
[cgutman] 55493: [USBHUB] - Don't wait for the work item to complete in the SCE completion handler - Use an event to signal the completion of a reset and wait for that event during IRP_MN_START_DEV...
by cgutman@svn.reactos.org
Author: cgutman Date: Wed Feb 8 15:50:52 2012 New Revision: 55493 URL:
http://svn.reactos.org/svn/reactos?rev=55493&view=rev
Log: [USBHUB] - Don't wait for the work item to complete in the SCE completion handler - Use an event to signal the completion of a reset and wait for that event during IRP_MN_START_DEVICE handling so devices are enumerated synchronously which allows USB boot devices to be enumerated Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.c branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/fdo.c [iso-8859-1] Wed Feb 8 15:50:52 2012 @@ -1,4 +1,4 @@ -/* +/* * PROJECT: ReactOS Universal Serial Bus Hub Driver * LICENSE: GPL - See COPYING in the top level directory * FILE: drivers/usb/usbhub/fdo.c @@ -260,6 +260,7 @@ PWORK_ITEM_DATA WorkItemData; PORT_STATUS_CHANGE PortStatus; LONG PortId; + BOOLEAN SignalResetComplete = FALSE; DPRINT1("Entered DeviceStatusChangeThread, Context %x\n", Context); @@ -404,16 +405,32 @@ // This is a new device // Status = CreateUsbChildDeviceObject(DeviceObject, PortId, NULL, PortStatus.Status); - } - } - - KeSetEvent(&WorkItemData->Event, IO_NO_INCREMENT, FALSE); + + // + // Request event signalling later + // + SignalResetComplete = TRUE; + } + } + + ExFreePool(WorkItemData); // // Send another SCE Request // DPRINT1("Sending another SCE!\n"); QueryStatusChangeEndpoint(DeviceObject); + + // + // Check if a reset event was satisfied + // + if (SignalResetComplete) + { + // + // Signal anyone waiting on it + // + KeSetEvent(&HubDeviceExtension->ResetComplete, IO_NO_INCREMENT, FALSE); + } } NTSTATUS @@ -446,24 +463,14 @@ return STATUS_INSUFFICIENT_RESOURCES; } WorkItemData->Context = RealDeviceObject; - KeInitializeEvent(&WorkItemData->Event, NotificationEvent, FALSE); - DPRINT1("Initialize work item\n"); + + DPRINT1("Queuing work item\n"); + + // + // Queue the work item to handle initializing the device + // ExInitializeWorkItem(&WorkItemData->WorkItem, DeviceStatusChangeThread, (PVOID)WorkItemData); - - // - // Queue the work item to handle initializing the device - // ExQueueWorkItem(&WorkItemData->WorkItem, DelayedWorkQueue); - - // - // Wait for the work item - // - KeWaitForSingleObject(&WorkItemData->Event, - Executive, - KernelMode, - FALSE, - NULL); - ExFreePool(WorkItemData); // // Return more processing required so the IO Manger doesnât try to mess with IRP just freed @@ -1467,7 +1474,21 @@ // Status = SetPortFeature(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId, PORT_RESET); if (!NT_SUCCESS(Status)) + { DPRINT1("Failed to reset on port %d\n", PortId); + } + else + { + // + // wait for the reset to be handled since we want to enumerate synchronously + // + KeWaitForSingleObject(&HubDeviceExtension->ResetComplete, + Executive, + KernelMode, + FALSE, + NULL); + KeClearEvent(&HubDeviceExtension->ResetComplete); + } } } } @@ -1807,7 +1828,7 @@ DPRINT1("RootHubInitNotification %x\n", HubDeviceExtension->HubInterface.RootHubInitNotification); // - // init roo hub notification + // init root hub notification // if (HubDeviceExtension->HubInterface.RootHubInitNotification) { @@ -1847,7 +1868,21 @@ // Status = SetPortFeature(HubDeviceExtension->RootHubPhysicalDeviceObject, PortId, PORT_RESET); if (!NT_SUCCESS(Status)) + { DPRINT1("Failed to reset on port %d\n", PortId); + } + else + { + // + // wait for the reset to be handled since we want to enumerate synchronously + // + KeWaitForSingleObject(&HubDeviceExtension->ResetComplete, + Executive, + KernelMode, + FALSE, + NULL); + KeClearEvent(&HubDeviceExtension->ResetComplete); + } } } } Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.c URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.c [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.c [iso-8859-1] Wed Feb 8 15:50:52 2012 @@ -90,6 +90,11 @@ DeviceObject->Flags |= DO_POWER_PAGABLE; // + // initialize reset complete event + // + KeInitializeEvent(&HubDeviceExtension->ResetComplete, NotificationEvent, FALSE); + + // // Attached to lower device // //Status = IoAttachDeviceToDeviceStackSafe(Fdo, Pdo, &DeviceExtension->LowerDevice); Modified: branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbhub_new/usbhub.h [iso-8859-1] Wed Feb 8 15:50:52 2012 @@ -44,7 +44,6 @@ typedef struct _WORK_ITEM_DATA { WORK_QUEUE_ITEM WorkItem; - KEVENT Event; PVOID Context; } WORK_ITEM_DATA, *PWORK_ITEM_DATA; @@ -80,6 +79,7 @@ PDEVICE_OBJECT RootHubFunctionalDeviceObject; ULONG NumberOfHubs; + KEVENT ResetComplete; PORT_STATUS_CHANGE *PortStatusChange; URB PendingSCEUrb;
12 years, 10 months
1
0
0
0
[pschweitzer] 55492: Tag the ReactOS 0.3.14 release
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Wed Feb 8 12:15:25 2012 New Revision: 55492 URL:
http://svn.reactos.org/svn/reactos?rev=55492&view=rev
Log: Tag the ReactOS 0.3.14 release Added: tags/ReactOS-0.3.14/ (props changed) - copied from r55491, branches/ros-branch-0_3_14/ Removed: branches/ros-branch-0_3_14/ Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ --- bugtraq:logregex (added) +++ bugtraq:logregex Wed Feb 8 12:15:25 2012 @@ -1,0 +1,2 @@ +([Ii]ssue|[Bb]ug)s? #?(\d+)(,? ?#?(\d+))*(,? ?(and |or )?#?(\d+))? +(\d+) Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ bugtraq:message = See issue #%BUGID% for more details. Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ bugtraq:url =
http://www.reactos.org/bugzilla/show_bug.cgi?id=%BUGID%
Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ --- svn:ignore (added) +++ svn:ignore Wed Feb 8 12:15:25 2012 @@ -1,0 +1,14 @@ +*.iso +makefile.auto +makefile-*.auto +config-*.rbuild +obj-* +output-* +reactos +reactos.* +RosBE-Logs +*.sln +*.ncb +*.suo +versionreport.xml +config.rbuild Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ --- svn:mergeinfo (added) +++ svn:mergeinfo Wed Feb 8 12:15:25 2012 @@ -1,0 +1,14 @@ +/branches/GSoC_2011/GSoC_Network:51548 +/branches/GSoC_2011/GSoC_TcpIpDriver:51550 +/branches/GSoC_2011/TcpIpDriver:51551-53074,53076-53119 +/branches/GSoC_Network:51545-51546 +/branches/cmake-bringup:50484,50693,50719,51544-52564 +/branches/header-work:45691-47721 +/branches/reactos-yarotows:45219-46371,46373-48025,48027-49273 +/branches/reactx/reactos:49994-49995 +/branches/ros-amd64-bringup:36852 +/branches/ros-amd64-bringup/reactos:34711-34712,34741,34743,34770,34780-34782,34803,34812,34839,34842,34864,34870,34874,34877,34908-34909,34917,34965,35323-35324,35347-35348,35361,35436,35509,35515,35588,35655,35683,35739,35746,35762,35771,35777,35781,35789,35805,35823,35827,35902,35904-35906,35942,35947-35949,35952-35953,35966,36011-36013,36172,36360,36380,36388-36389,36393,36397,36443,36445,36475,36502-36503,36505,36570,36614,36852,36898-36899,36930,36936,36949,36951,36958,36961,36964,36969,36972,36987-36988,36990,36992,37019,37322-37323,37333-37334,37434,37472,37475,37536,37820-37821,37868-37869,37873,37990-37991,38013-38014,38092,38100,38148-38151,38264-38265,38268,38355,39151,39333,39335,39345,39639,40120,40122-40123,40125,40127-40128,40155,40247,40324,40608,40753,40926-40928,40986-40987,40989,40991,40993,40995-40996,41000-41001,41027-41030,41044-41045,41047-41050,41052,41070,41082-41086,41097-41098,41101,41449,41479-41480,41483-41485,41499-41500,41502,41531,41536,41540,41546-41547,41549,43080,43426,43451,43454,43506,43566,43574,43598,43600-43602,43604-43605,43677,43682,43757,43775,43836,43838-43840,43852,43857-43858,43860,43905-43907,43952,43954,43965,43969,43979,43981,43992,44002,44036-44037,44039-44040,44044-44045,44053,44065,44095,44123,44143-44144,44205,44238,44257,44259,44294,44338-44339,44385,44389,44391,44426,44460,44467-44468,44470-44471,44499,44501,44503-44504,44506,44510-44512,44521,44523-44526,44530,44540,44601,44634,44639,44772,44818,45124,45126-45127,45430,46394,46404,46478,46511,46523-46524,46526,46534-46535,46537-46539,46589,46805,46868,47472,47846-47847,47878,47882 +/branches/shell32_new-bringup:51893-53652,53661,53700 +/branches/tcp-rewrite-branch:48720,48840-48841,49424-49426,49454 +/branches/wlan-bringup:54809-54998 +/trunk/reactos:55012,55173,55430,55432 Propchange: tags/ReactOS-0.3.14/ ------------------------------------------------------------------------------ tsvn:logminsize = 10
12 years, 10 months
1
0
0
0
[janderwald] 55491: [USBEHCI] - Fix a few bulk transfer bugs - Enable interrupt completion on last interrupt - Increment transferred offset - Mass storage device now gets further (passing SRB_FUNCT...
by janderwald@svn.reactos.org
Author: janderwald Date: Wed Feb 8 01:10:36 2012 New Revision: 55491 URL:
http://svn.reactos.org/svn/reactos?rev=55491&view=rev
Log: [USBEHCI] - Fix a few bulk transfer bugs - Enable interrupt completion on last interrupt - Increment transferred offset - Mass storage device now gets further (passing SRB_FUNCTION_CLAIM_DEVICE) Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] Wed Feb 8 01:10:36 2012 @@ -594,6 +594,7 @@ // initialized with setup packet, must be a control transfer // TransferType = USB_ENDPOINT_TYPE_CONTROL; + ASSERT(m_EndpointDescriptor == FALSE); } // @@ -1048,7 +1049,7 @@ PQUEUE_HEAD QueueHead; PVOID Base; ULONG ChainDescriptorLength; - PQUEUE_TRANSFER_DESCRIPTOR FirstDescriptor; + PQUEUE_TRANSFER_DESCRIPTOR FirstDescriptor, LastDescriptor; // // Allocate the queue head @@ -1096,7 +1097,7 @@ InternalGetPidDirection(), m_EndpointDescriptor->DataToggle, &FirstDescriptor, - NULL, + &LastDescriptor, &m_EndpointDescriptor->DataToggle, &ChainDescriptorLength); @@ -1104,6 +1105,13 @@ // FIXME: handle errors // ASSERT(ChainDescriptorLength == m_TransferBufferLength); + + // + // move to next offset + // + m_TransferBufferLengthCompleted += ChainDescriptorLength; + + ASSERT(Status == STATUS_SUCCESS); // @@ -1114,10 +1122,27 @@ QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->EndPointDescriptor.wMaxPacketSize; QueueHead->NextPointer = FirstDescriptor->PhysicalAddr; + + ASSERT(QueueHead->EndPointCharacteristics.DeviceAddress); + ASSERT(QueueHead->EndPointCharacteristics.EndPointNumber); + ASSERT(QueueHead->EndPointCharacteristics.MaximumPacketLength); + ASSERT(QueueHead->NextPointer); + + // + // interrupt on last descriptor + // + LastDescriptor->Token.Bits.InterruptOnComplete = TRUE; + // // store result // *OutHead = QueueHead; + + // + // dump status + // + //DPRINT1("bEndpoint %x\n", m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress); + //DumpQueueHead(QueueHead); // // done
12 years, 10 months
1
0
0
0
[janderwald] 55490: [USBEHCI] - Merge hub controller from usbohci - Partly implement AbortPipe request - Implement resetting data toggle in HandleSyncResetAndClearStall
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Feb 7 22:20:46 2012 New Revision: 55490 URL:
http://svn.reactos.org/svn/reactos?rev=55490&view=rev
Log: [USBEHCI] - Merge hub controller from usbohci - Partly implement AbortPipe request - Implement resetting data toggle in HandleSyncResetAndClearStall Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hub_controller.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hub_controller.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/hub_controller.cpp [iso-8859-1] Tue Feb 7 22:20:46 2012 @@ -70,6 +70,9 @@ NTSTATUS HandleClassEndpoint(IN OUT PIRP Irp, PURB Urb); NTSTATUS HandleBulkOrInterruptTransfer(IN OUT PIRP Irp, PURB Urb); NTSTATUS HandleIsochronousTransfer(IN OUT PIRP Irp, PURB Urb); + NTSTATUS HandleClearStall(IN OUT PIRP Irp, PURB Urb); + NTSTATUS HandleSyncResetAndClearStall(IN OUT PIRP Irp, PURB Urb); + NTSTATUS HandleAbortPipe(IN OUT PIRP Irp, PURB Urb); friend VOID StatusChangeEndpointCallBack(PVOID Context); @@ -1675,12 +1678,21 @@ // // initialize setup packet // - CtrlSetup.bmRequestType.B = 0xa2; //FIXME: Const. + CtrlSetup.bmRequestType.B = 0x22; //FIXME: Const. CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request; CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value; CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index; CtrlSetup.wLength = Urb->UrbControlVendorClassRequest.TransferBufferLength; + if (Urb->UrbControlVendorClassRequest.TransferFlags & USBD_TRANSFER_DIRECTION_IN) + { + // + // data direction is device to host + // + CtrlSetup.bmRequestType.B |= 0x80; + } + + // // issue request // @@ -1697,6 +1709,185 @@ // return Status; } + +NTSTATUS +CHubController::HandleSyncResetAndClearStall( + IN OUT PIRP Irp, + IN OUT PURB Urb) +{ + NTSTATUS Status = STATUS_SUCCESS; + PUSB_ENDPOINT EndpointDescriptor; + ULONG Type; + + // + // sanity check + // + PC_ASSERT(Urb->UrbHeader.UsbdDeviceHandle); + PC_ASSERT(Urb->UrbHeader.Length == sizeof(struct _URB_PIPE_REQUEST)); + PC_ASSERT(Urb->UrbPipeRequest.PipeHandle); + + // + // check if this is a valid usb device handle + // + if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle))) + { + DPRINT1("HandleAbortPipe invalid device handle %p\n", Urb->UrbHeader.UsbdDeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // get endpoint descriptor + // + EndpointDescriptor = (PUSB_ENDPOINT)Urb->UrbPipeRequest.PipeHandle; + + // + // get type + // + Type = (EndpointDescriptor->EndPointDescriptor.bmAttributes & USB_ENDPOINT_TYPE_MASK); + if (Type != USB_ENDPOINT_TYPE_ISOCHRONOUS) + { + // + // clear stall + // + Status = HandleClearStall(Irp, Urb); + } + DPRINT1("URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL Status %x\n", Status); + + // + // reset data toggle + // + ASSERT(NT_SUCCESS(Status)); + EndpointDescriptor->DataToggle = 0x0; + + // + // done + // + return Status; +} + +NTSTATUS +CHubController::HandleAbortPipe( + IN OUT PIRP Irp, + IN OUT PURB Urb) +{ + NTSTATUS Status; + PUSBDEVICE UsbDevice; + PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor; + + // + // sanity check + // + PC_ASSERT(Urb->UrbHeader.UsbdDeviceHandle); + PC_ASSERT(Urb->UrbHeader.Length == sizeof(struct _URB_PIPE_REQUEST)); + PC_ASSERT(Urb->UrbPipeRequest.PipeHandle); + + // + // check if this is a valid usb device handle + // + if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle))) + { + DPRINT1("HandleAbortPipe invalid device handle %p\n", Urb->UrbHeader.UsbdDeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // get endpoint descriptor + // + EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR)Urb->UrbPipeRequest.PipeHandle; + + // + // get device + // + UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle); + + + // + // issue request + // + Status = UsbDevice->AbortPipe(EndpointDescriptor); + DPRINT1("URB_FUNCTION_ABORT_PIPE Status %x\n", Status); + + // + // done + // + return Status; +} + + +//----------------------------------------------------------------------------------------- +NTSTATUS +CHubController::HandleClearStall( + IN OUT PIRP Irp, + IN OUT PURB Urb) +{ + USB_DEFAULT_PIPE_SETUP_PACKET CtrlSetup; + NTSTATUS Status; + PUSBDEVICE UsbDevice; + PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor; + + + // + // sanity check + // + PC_ASSERT(Urb->UrbHeader.UsbdDeviceHandle); + PC_ASSERT(Urb->UrbHeader.Length == sizeof(struct _URB_PIPE_REQUEST)); + PC_ASSERT(Urb->UrbPipeRequest.PipeHandle); + + // + // check if this is a valid usb device handle + // + if (!ValidateUsbDevice(PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle))) + { + DPRINT1("HandleClearStall invalid device handle %p\n", Urb->UrbHeader.UsbdDeviceHandle); + + // + // invalid device handle + // + return STATUS_DEVICE_NOT_CONNECTED; + } + + // + // get endpoint descriptor + // + EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR)Urb->UrbPipeRequest.PipeHandle; + + // + // get device + // + UsbDevice = PUSBDEVICE(Urb->UrbHeader.UsbdDeviceHandle); + DPRINT1("URB_FUNCTION_SYNC_CLEAR_STALL\n"); + + // + // initialize setup packet + // + CtrlSetup.bmRequestType.B = 0x02; + CtrlSetup.bRequest = USB_REQUEST_CLEAR_FEATURE; + CtrlSetup.wValue.W = USB_FEATURE_ENDPOINT_STALL; + CtrlSetup.wIndex.W = EndpointDescriptor->bEndpointAddress; + CtrlSetup.wLength = 0; + CtrlSetup.wValue.W = 0; + + // + // issue request + // + Status = UsbDevice->SubmitSetupPacket(&CtrlSetup, 0, 0); + + DPRINT1("URB_FUNCTION_CLEAR_STALL Status %x\n", Status); + + // + // done + // + return Status; +} + //----------------------------------------------------------------------------------------- NTSTATUS @@ -1747,12 +1938,20 @@ // // initialize setup packet // - CtrlSetup.bmRequestType.B = 0xa1; //FIXME: Const. + CtrlSetup.bmRequestType.B = 0x21; CtrlSetup.bRequest = Urb->UrbControlVendorClassRequest.Request; CtrlSetup.wValue.W = Urb->UrbControlVendorClassRequest.Value; CtrlSetup.wIndex.W = Urb->UrbControlVendorClassRequest.Index; CtrlSetup.wLength = Urb->UrbControlVendorClassRequest.TransferBufferLength; + if (Urb->UrbControlVendorClassRequest.TransferFlags & USBD_TRANSFER_DIRECTION_IN) + { + // + // data direction is device to host + // + CtrlSetup.bmRequestType.B |= 0x80; + } + // // issue request // @@ -1761,8 +1960,13 @@ // // assert on failure // - PC_ASSERT(NT_SUCCESS(Status)); - + if (!NT_SUCCESS(Status)) + { + // + // display error + // + DPRINT1("URB_FUNCTION_CLASS_INTERFACE failed with Urb Status %x\n", Urb->UrbHeader.Status); + } // // done @@ -1806,6 +2010,16 @@ switch (Urb->UrbHeader.Function) { + case URB_FUNCTION_SYNC_RESET_PIPE: + case URB_FUNCTION_SYNC_RESET_PIPE_AND_CLEAR_STALL: + Status = HandleSyncResetAndClearStall(Irp, Urb); + break; + case URB_FUNCTION_ABORT_PIPE: + Status = HandleAbortPipe(Irp, Urb); + break; + case URB_FUNCTION_SYNC_CLEAR_STALL: + Status = HandleClearStall(Irp, Urb); + break; case URB_FUNCTION_GET_DESCRIPTOR_FROM_INTERFACE: Status = HandleGetDescriptorFromInterface(Irp, Urb); break; Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] Tue Feb 7 22:20:46 2012 @@ -589,6 +589,15 @@ // This function gets called by IUSBHardware after it the Interrupt on Async Advance bit has been set virtual VOID CompleteAsyncRequests() = 0; + +//----------------------------------------------------------------------------------------- +// +// AbortDevicePipe +// +// Description: aborts all pending requsts of an device + + virtual NTSTATUS AbortDevicePipe(UCHAR DeviceAddress, IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) = 0; + }; typedef IUSBQueue *PUSBQUEUE; @@ -842,6 +851,15 @@ virtual NTSTATUS SelectInterface(IN USBD_CONFIGURATION_HANDLE ConfigurationHandle, IN OUT PUSBD_INTERFACE_INFORMATION Interface) = 0; + +//----------------------------------------------------------------------------------------- +// +// AbortPipe +// +// Description: aborts all pending requsts + + virtual NTSTATUS AbortPipe(IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) = 0; + }; typedef IUSBDevice *PUSBDEVICE; Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] Tue Feb 7 22:20:46 2012 @@ -52,6 +52,8 @@ virtual NTSTATUS SubmitSetupPacket(IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, OUT ULONG BufferLength, OUT PVOID Buffer); virtual NTSTATUS SelectConfiguration(IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN PUSBD_INTERFACE_INFORMATION Interface, OUT USBD_CONFIGURATION_HANDLE *ConfigurationHandle); virtual NTSTATUS SelectInterface(IN USBD_CONFIGURATION_HANDLE ConfigurationHandle, IN OUT PUSBD_INTERFACE_INFORMATION Interface); + virtual NTSTATUS AbortPipe(IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor); + // local function virtual NTSTATUS CommitIrp(PIRP Irp); @@ -1255,6 +1257,23 @@ return Status; } +NTSTATUS +CUSBDevice::AbortPipe( + IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) +{ + // + // let it handle usb queue + // + ASSERT(m_Queue); + ASSERT(m_DeviceAddress); + + // + // done + // + return m_Queue->AbortDevicePipe(m_DeviceAddress, EndpointDescriptor); +} + + //---------------------------------------------------------------------------------------- NTSTATUS CreateUSBDevice( Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] Tue Feb 7 22:20:46 2012 @@ -41,6 +41,8 @@ virtual NTSTATUS CreateUSBRequest(IUSBRequest **OutRequest); virtual VOID InterruptCallback(IN NTSTATUS Status, OUT PULONG ShouldRingDoorBell); virtual VOID CompleteAsyncRequests(); + virtual NTSTATUS AbortDevicePipe(UCHAR DeviceAddress, IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor); + // constructor / destructor CUSBQueue(IUnknown *OuterUnknown){} @@ -925,6 +927,16 @@ } NTSTATUS +CUSBQueue::AbortDevicePipe( + IN UCHAR DeviceAddress, + IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor) +{ + UNIMPLEMENTED + return STATUS_NOT_IMPLEMENTED; +} + + +NTSTATUS CreateUSBQueue( PUSBQUEUE *OutUsbQueue) { @@ -957,3 +969,4 @@ // return STATUS_SUCCESS; } +
12 years, 10 months
1
0
0
0
[janderwald] 55489: [USBEHCI] - Rewrite the transfer descriptor handling - Take into account the direction of the pid - Revert previously added hacks - Support now more than one transfer descriptor...
by janderwald@svn.reactos.org
Author: janderwald Date: Tue Feb 7 21:48:05 2012 New Revision: 55489 URL:
http://svn.reactos.org/svn/reactos?rev=55489&view=rev
Log: [USBEHCI] - Rewrite the transfer descriptor handling - Take into account the direction of the pid - Revert previously added hacks - Support now more than one transfer descriptor for control transfers - Include the bulk transfers in one queue head which should speed up operation - Store data toggle in usb endpoint structure - Mass storage devices now passes the control status phase on real hw and enters bulk operation stage Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.h branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp branches/usb-bringup-trunk/drivers/usb/usbehci_new/usbehci.h Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -1339,6 +1339,7 @@ // controller reported error // DPRINT1("CStatus %x\n", CStatus); + ASSERT(FALSE); } // Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.h [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.h [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -148,7 +148,7 @@ //Software ULONG PhysicalAddr; - LIST_ENTRY LinkedDescriptors; + LIST_ENTRY DescriptorEntry; ULONG TotalBytesToTransfer; } QUEUE_TRANSFER_DESCRIPTOR, *PQUEUE_TRANSFER_DESCRIPTOR; @@ -216,6 +216,7 @@ //Software ULONG PhysicalAddr; LIST_ENTRY LinkedQueueHeads; + LIST_ENTRY TransferDescriptorListHead; PVOID Request; } QUEUE_HEAD, *PQUEUE_HEAD; @@ -292,3 +293,4 @@ ULONG PortChange; }EHCI_PORT_STATUS; + Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/interfaces.h [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -379,6 +379,7 @@ // struct _QUEUE_HEAD; +struct _USB_ENDPOINT; DECLARE_INTERFACE_(IUSBRequest, IUnknown) { @@ -395,7 +396,7 @@ virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN UCHAR DeviceAddress, - IN OPTIONAL PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor, + IN OPTIONAL struct _USB_ENDPOINT *EndpointDescriptor, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer) = 0; Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_device.cpp [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -10,24 +10,6 @@ #define INITGUID #include "usbehci.h" - -typedef struct _USB_ENDPOINT -{ - USB_ENDPOINT_DESCRIPTOR EndPointDescriptor; -} USB_ENDPOINT, *PUSB_ENDPOINT; - -typedef struct _USB_INTERFACE -{ - USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; - USB_ENDPOINT *EndPoints; -} USB_INTERFACE, *PUSB_INTERFACE; - -typedef struct _USB_CONFIGURATION -{ - USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; - USB_INTERFACE *Interfaces; -} USB_CONFIGURATION, *PUSB_CONFIGURATION; - class CUSBDevice : public IUSBDevice { @@ -73,7 +55,7 @@ // local function virtual NTSTATUS CommitIrp(PIRP Irp); - virtual NTSTATUS CommitSetupPacket(PUSB_DEFAULT_PIPE_SETUP_PACKET Packet, IN OPTIONAL PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor, IN ULONG BufferLength, IN OUT PMDL Mdl); + virtual NTSTATUS CommitSetupPacket(PUSB_DEFAULT_PIPE_SETUP_PACKET Packet, IN OPTIONAL PUSB_ENDPOINT EndpointDescriptor, IN ULONG BufferLength, IN OUT PMDL Mdl); virtual NTSTATUS CreateConfigurationDescriptor(ULONG ConfigurationIndex); virtual NTSTATUS CreateDeviceDescriptor(); virtual VOID DumpDeviceDescriptor(PUSB_DEVICE_DESCRIPTOR DeviceDescriptor); @@ -537,7 +519,7 @@ NTSTATUS CUSBDevice::CommitSetupPacket( IN PUSB_DEFAULT_PIPE_SETUP_PACKET Packet, - IN OPTIONAL PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor, + IN OPTIONAL PUSB_ENDPOINT EndpointDescriptor, IN ULONG BufferLength, IN OUT PMDL Mdl) { Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_queue.cpp [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -499,11 +499,6 @@ // remove software link // RemoveEntryList(&QueueHead->LinkedQueueHeads); - - // - // FIXME: clear failure - // - QueueHead->Token.Bits.Halted = FALSE; } // Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usb_request.cpp [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -36,7 +36,7 @@ } // IUSBRequest interface functions - virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN UCHAR DeviceAddress, IN OPTIONAL PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer); + virtual NTSTATUS InitializeWithSetupPacket(IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN UCHAR DeviceAddress, IN OPTIONAL PUSB_ENDPOINT EndpointDescriptor, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer); virtual NTSTATUS InitializeWithIrp(IN PDMAMEMORYMANAGER DmaManager, IN OUT PIRP Irp); virtual VOID CompletionCallback(IN NTSTATUS NtStatusCode, IN ULONG UrbStatusCode, IN struct _QUEUE_HEAD *QueueHead); virtual VOID CancelCallback(IN NTSTATUS NtStatusCode, IN struct _QUEUE_HEAD *QueueHead); @@ -62,6 +62,10 @@ NTSTATUS BuildSetupPacket(); NTSTATUS BuildSetupPacketFromURB(); ULONG InternalCalculateTransferLength(); + NTSTATUS BuildTransferDescriptorChain(IN PQUEUE_HEAD QueueHead, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR InitialDataToggle, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, OUT PUCHAR OutDataToggle, OUT PULONG OutTransferBufferOffset); + VOID InitDescriptor(IN PQUEUE_TRANSFER_DESCRIPTOR CurrentDescriptor, IN PVOID TransferBuffer, IN ULONG TransferBufferLength, IN UCHAR PidCode, IN UCHAR DataToggle, OUT PULONG OutDescriptorLength); + VOID DumpQueueHead(IN PQUEUE_HEAD QueueHead); + // constructor / destructor CUSBRequest(IUnknown *OuterUnknown){} @@ -118,17 +122,12 @@ // // store end point address // - PUSB_ENDPOINT_DESCRIPTOR m_EndpointDescriptor; + PUSB_ENDPOINT m_EndpointDescriptor; // // DMA queue head // PQUEUE_HEAD m_QueueHead; - - // - // DMA transfer descriptors linked to the queue head - // - PQUEUE_TRANSFER_DESCRIPTOR m_TransferDescriptors[4]; // // allocated setup packet from the DMA pool @@ -160,7 +159,7 @@ IN PDMAMEMORYMANAGER DmaManager, IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket, IN UCHAR DeviceAddress, - IN OPTIONAL PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor, + IN OPTIONAL PUSB_ENDPOINT EndpointDescriptor, IN OUT ULONG TransferBufferLength, IN OUT PMDL TransferBuffer) { @@ -321,7 +320,7 @@ // // get endpoint descriptor // - m_EndpointDescriptor = (PUSB_ENDPOINT_DESCRIPTOR)Urb->UrbBulkOrInterruptTransfer.PipeHandle; + m_EndpointDescriptor = (PUSB_ENDPOINT)Urb->UrbBulkOrInterruptTransfer.PipeHandle; } break; @@ -587,7 +586,7 @@ // // end point is defined in the low byte of bmAttributes // - TransferType = (m_EndpointDescriptor->bmAttributes & USB_ENDPOINT_TYPE_MASK); + TransferType = (m_EndpointDescriptor->EndPointDescriptor.bmAttributes & USB_ENDPOINT_TYPE_MASK); } else { @@ -606,13 +605,223 @@ UCHAR CUSBRequest::InternalGetPidDirection() { - ASSERT(m_Irp); - ASSERT(m_EndpointDescriptor); - - // - // end point is defined in the low byte of bEndpointAddress - // - return (m_EndpointDescriptor->bEndpointAddress & USB_ENDPOINT_DIRECTION_MASK) >> 7; + if (m_EndpointDescriptor) + { + // + // end point direction is highest bit in bEndpointAddress + // + return (m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress & USB_ENDPOINT_DIRECTION_MASK) >> 7; + } + else + { + // + // request arrives on the control pipe, extract direction from setup packet + // + ASSERT(m_DescriptorPacket); + return (m_DescriptorPacket->bmRequestType.B >> 7); + } +} + +VOID +CUSBRequest::InitDescriptor( + IN PQUEUE_TRANSFER_DESCRIPTOR CurrentDescriptor, + IN PVOID TransferBuffer, + IN ULONG TransferBufferLength, + IN UCHAR PidCode, + IN UCHAR DataToggle, + OUT PULONG OutDescriptorLength) +{ + ULONG Index, Length = 0, PageOffset, BufferLength; + + // + // init transfer descriptor + // + CurrentDescriptor->Token.Bits.PIDCode = PidCode; + CurrentDescriptor->Token.Bits.TotalBytesToTransfer = 0; + CurrentDescriptor->Token.Bits.DataToggle = DataToggle; + + // + // sanity check + // + ASSERT(TransferBufferLength); + + // + // store buffers + // + Index = 0; + do + { + // + // use physical address + // + CurrentDescriptor->BufferPointer[Index] = MmGetPhysicalAddress(TransferBuffer).LowPart; + + // + // Get the offset from page size + // + PageOffset = BYTE_OFFSET(TransferBuffer); + + // + // move to next page + // + TransferBuffer = (PVOID)ROUND_TO_PAGES(TransferBuffer); + + // + // calculate buffer length + // + BufferLength = min(TransferBufferLength, PAGE_SIZE - PageOffset); + + // + // increment transfer bytes + // + CurrentDescriptor->Token.Bits.TotalBytesToTransfer += BufferLength; + CurrentDescriptor->TotalBytesToTransfer += BufferLength; + Length += BufferLength; + DPRINT1("Index %lu Length %lu\n", Index, Length); + + // + // decrement available byte count + // + TransferBufferLength -= BufferLength; + if (TransferBufferLength == 0) + { + // + // end reached + // + break; + } + + // + // next descriptor index + // + Index++; + }while(Index < 5); + + // + // store result + // + *OutDescriptorLength = Length; +} + + +NTSTATUS +CUSBRequest::BuildTransferDescriptorChain( + IN PQUEUE_HEAD QueueHead, + IN PVOID TransferBuffer, + IN ULONG TransferBufferLength, + IN UCHAR PidCode, + IN UCHAR InitialDataToggle, + OUT PQUEUE_TRANSFER_DESCRIPTOR * OutFirstDescriptor, + OUT PQUEUE_TRANSFER_DESCRIPTOR * OutLastDescriptor, + OUT PUCHAR OutDataToggle, + OUT PULONG OutTransferBufferOffset) +{ + PQUEUE_TRANSFER_DESCRIPTOR FirstDescriptor = NULL, CurrentDescriptor, LastDescriptor = NULL; + NTSTATUS Status; + ULONG DescriptorLength, TransferBufferOffset = 0; + + do + { + // + // allocate transfer descriptor + // + Status = CreateDescriptor(&CurrentDescriptor); + if (!NT_SUCCESS(Status)) + { + // + // failed to allocate transfer descriptor + // + ASSERT(FALSE); + return Status; + } + + DPRINT1("BuildTransferDescriptorChain TransferBufferLength %lu TransferBufferOffset %lu\n", TransferBufferLength, TransferBufferOffset); + // + // now init the descriptor + // + InitDescriptor(CurrentDescriptor, + (PVOID)((ULONG_PTR)TransferBuffer + TransferBufferOffset), + TransferBufferLength - TransferBufferOffset, + PidCode, + InitialDataToggle, + &DescriptorLength); + + // + // insert into queue head + // + InsertTailList(&QueueHead->TransferDescriptorListHead, &CurrentDescriptor->DescriptorEntry); + + // + // adjust offset + // + TransferBufferOffset += DescriptorLength; + + if (LastDescriptor) + { + // + // link to current descriptor + // + LastDescriptor->AlternateNextPointer = CurrentDescriptor->PhysicalAddr; + LastDescriptor->NextPointer = CurrentDescriptor->PhysicalAddr; + } + else + { + // + // first descriptor in chain + // + LastDescriptor = FirstDescriptor = CurrentDescriptor; + } + + // + // flip data toggle + // + InitialDataToggle = !InitialDataToggle; + + if(TransferBufferLength == TransferBufferOffset) + { + // + // end reached + // + break; + } + }while(TRUE); + + if (OutFirstDescriptor) + { + // + // store first descriptor + // + *OutFirstDescriptor = FirstDescriptor; + } + + if (OutLastDescriptor) + { + // + // store last descriptor + // + *OutLastDescriptor = CurrentDescriptor; + } + + if (OutDataToggle) + { + // + // store result data toggle + // + *OutDataToggle = InitialDataToggle; + } + + if (OutTransferBufferOffset) + { + // + // store offset + // + *OutTransferBufferOffset = TransferBufferOffset; + } + + // + // done + // + return STATUS_SUCCESS; } //---------------------------------------------------------------------------------------- @@ -621,8 +830,9 @@ PQUEUE_HEAD * OutHead) { NTSTATUS Status; - ULONG NumTransferDescriptors, Index; + ULONG DescriptorChainLength; PQUEUE_HEAD QueueHead; + PQUEUE_TRANSFER_DESCRIPTOR SetupDescriptor, StatusDescriptor, FirstDescriptor, LastDescriptor; // // first allocate the queue head @@ -650,30 +860,34 @@ // // failed to allocate setup packet // + ASSERT(FALSE); return STATUS_INSUFFICIENT_RESOURCES; } // - // calculate num of transfer descriptors - // - NumTransferDescriptors = m_TransferBufferMDL != 0 ? 3 : 2; - - // - // allocate transfer descriptors - // - for(Index = 0; Index < NumTransferDescriptors; Index++) - { - // - // allocate transfer descriptor - // - Status = CreateDescriptor(&m_TransferDescriptors[Index]); - if (!NT_SUCCESS(Status)) - { - // - // failed to allocate transfer descriptor - // - return Status; - } + // create setup descriptor + // + Status = CreateDescriptor(&SetupDescriptor); + if (!NT_SUCCESS(Status)) + { + // + // failed to allocate transfer descriptor + // + ASSERT(FALSE); + return Status; + } + + // + // create status descriptor + // + Status = CreateDescriptor(&StatusDescriptor); + if (!NT_SUCCESS(Status)) + { + // + // failed to allocate transfer descriptor + // + ASSERT(FALSE); + return Status; } // @@ -686,102 +900,86 @@ // // set endpoint address and max packet length // - QueueHead->EndPointCharacteristics.EndPointNumber = m_EndpointDescriptor->bEndpointAddress & 0x0F; - QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->wMaxPacketSize; - } - - // - // setup descriptors - // - m_TransferDescriptors[0]->Token.Bits.PIDCode = PID_CODE_SETUP_TOKEN; - m_TransferDescriptors[0]->Token.Bits.TotalBytesToTransfer = sizeof(USB_DEFAULT_PIPE_SETUP_PACKET); - m_TransferDescriptors[0]->Token.Bits.DataToggle = FALSE; - m_TransferDescriptors[0]->BufferPointer[0] = (ULONG)PtrToUlong(m_DescriptorSetupPacket.LowPart); - m_TransferDescriptors[0]->NextPointer = m_TransferDescriptors[1]->PhysicalAddr; - m_TransferDescriptors[0]->AlternateNextPointer = m_TransferDescriptors[1]->PhysicalAddr; - - if (m_TransferBufferMDL) - { - // - // setup in descriptor - // - m_TransferDescriptors[1]->Token.Bits.PIDCode = PID_CODE_IN_TOKEN; - m_TransferDescriptors[1]->Token.Bits.TotalBytesToTransfer = m_TransferBufferLength; - m_TransferDescriptors[1]->NextPointer = m_TransferDescriptors[2]->PhysicalAddr; - m_TransferDescriptors[1]->Token.Bits.DataToggle = TRUE; - m_TransferDescriptors[1]->AlternateNextPointer = m_TransferDescriptors[2]->PhysicalAddr; - - // - // FIXME: check if the request spawns over a page -> fill other members - // - PC_ASSERT(m_TransferBufferLength <= PAGE_SIZE); - m_TransferDescriptors[1]->BufferPointer[0] = MmGetPhysicalAddress(MmGetMdlVirtualAddress(m_TransferBufferMDL)).LowPart; - - // - // setup out descriptor - // - m_TransferDescriptors[2]->Token.Bits.PIDCode = PID_CODE_OUT_TOKEN; - m_TransferDescriptors[2]->Token.Bits.TotalBytesToTransfer = 0; - m_TransferDescriptors[2]->Token.Bits.DataToggle = TRUE; - - // - // special case, setup alternative next descriptor in case of error - // HAIKU links to dead descriptor - // - - // - // interrupt on completion - // - m_TransferDescriptors[2]->Token.Bits.InterruptOnComplete = TRUE; + QueueHead->EndPointCharacteristics.EndPointNumber = m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress & 0x0F; + QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->EndPointDescriptor.wMaxPacketSize; + } + + // + // init setup descriptor + // + SetupDescriptor->Token.Bits.PIDCode = PID_CODE_SETUP_TOKEN; + SetupDescriptor->Token.Bits.TotalBytesToTransfer = sizeof(USB_DEFAULT_PIPE_SETUP_PACKET); + SetupDescriptor->Token.Bits.DataToggle = FALSE; + SetupDescriptor->BufferPointer[0] = (ULONG)PtrToUlong(m_DescriptorSetupPacket.LowPart); + InsertTailList(&QueueHead->TransferDescriptorListHead, &SetupDescriptor->DescriptorEntry); + + + // + // init status descriptor + // + StatusDescriptor->Token.Bits.TotalBytesToTransfer = 0; + StatusDescriptor->Token.Bits.DataToggle = TRUE; + StatusDescriptor->Token.Bits.InterruptOnComplete = TRUE; + + // + // is there data + // + if (m_TransferBufferLength) + { + Status = BuildTransferDescriptorChain(QueueHead, + MmGetMdlVirtualAddress(m_TransferBufferMDL), + m_TransferBufferLength, + InternalGetPidDirection(), + TRUE, + &FirstDescriptor, + &LastDescriptor, + NULL, + &DescriptorChainLength); + + // + // FIXME handle errors + // + ASSERT(Status == STATUS_SUCCESS); + ASSERT(DescriptorChainLength == m_TransferBufferLength); + + // + // now link the descriptors + // + SetupDescriptor->NextPointer = FirstDescriptor->PhysicalAddr; + SetupDescriptor->AlternateNextPointer = FirstDescriptor->PhysicalAddr; + LastDescriptor->NextPointer = StatusDescriptor->PhysicalAddr; + LastDescriptor->AlternateNextPointer = StatusDescriptor->PhysicalAddr; + + + // + // pid code is flipped for ops with data stage + // + StatusDescriptor->Token.Bits.PIDCode = !InternalGetPidDirection(); } else { // - // no buffer, setup in descriptor - // - m_TransferDescriptors[1]->Token.Bits.PIDCode = PID_CODE_IN_TOKEN; - m_TransferDescriptors[1]->Token.Bits.TotalBytesToTransfer = 0; - m_TransferDescriptors[1]->Token.Bits.DataToggle = TRUE; - - // - // interrupt on completion - // - m_TransferDescriptors[1]->Token.Bits.InterruptOnComplete = TRUE; - } + // direct link + // + SetupDescriptor->NextPointer = StatusDescriptor->PhysicalAddr; + SetupDescriptor->AlternateNextPointer = StatusDescriptor->PhysicalAddr; + + // + // retrieve result of operation + // + StatusDescriptor->Token.Bits.PIDCode = PID_CODE_IN_TOKEN; + } + + // + // insert status descriptor + // + InsertTailList(&QueueHead->TransferDescriptorListHead, &StatusDescriptor->DescriptorEntry); + // // link transfer descriptors to queue head // - QueueHead->NextPointer = m_TransferDescriptors[0]->PhysicalAddr; - - DPRINT("QueueHead %p Addr %x\n", QueueHead, QueueHead->PhysicalAddr); - DPRINT("NumDescriptors %lu\n", NumTransferDescriptors); - DPRINT("QueueHead AlternateNextPointer %x\n", QueueHead->AlternateNextPointer); - DPRINT("QueueHead NextPointer %x\n", QueueHead->NextPointer); - DPRINT("m_DescriptorSetupPacket HiPart %x LoPart %x\n", m_DescriptorSetupPacket.HighPart, m_DescriptorSetupPacket.LowPart); - - - DPRINT("TransferDescriptor 0 Addr %x\n", m_TransferDescriptors[0]->PhysicalAddr); - DPRINT("TransferDescriptor 0 Next %x\n", m_TransferDescriptors[0]->NextPointer); - DPRINT("TransferDescriptor 0 AlternativeNext %x\n", m_TransferDescriptors[0]->AlternateNextPointer); - DPRINT("TransferDescriptor 0 Buffer Pointer %x\n", m_TransferDescriptors[0]->BufferPointer[0]); - DPRINT("TransferDescriptor 0 TotalBytesToTransfer 0x%x\n", m_TransferDescriptors[0]->Token.Bits.TotalBytesToTransfer); - - DPRINT("TransferDescriptor 1 Addr %x\n", m_TransferDescriptors[1]->PhysicalAddr); - DPRINT("TransferDescriptor 1 Next %x\n", m_TransferDescriptors[1]->NextPointer); - DPRINT("TransferDescriptor 1 AlternativeNext %x\n", m_TransferDescriptors[1]->AlternateNextPointer); - DPRINT("TransferDescriptor 1 Buffer Pointer %x\n", m_TransferDescriptors[1]->BufferPointer[0]); - DPRINT("TransferDescriptor 1 TotalBytesToTransfer 0x%x\n", m_TransferDescriptors[1]->Token.Bits.TotalBytesToTransfer); - - if (NumTransferDescriptors == 3) - { - DPRINT("TransferDescriptor 2 Addr %x\n", m_TransferDescriptors[2]->PhysicalAddr); - DPRINT("TransferDescriptor 2 Next %x\n", m_TransferDescriptors[2]->NextPointer); - DPRINT("TransferDescriptor 2 AlternativeNext %x\n", m_TransferDescriptors[2]->AlternateNextPointer); - DPRINT("TransferDescriptor 2 Buffer Pointer %x\n", m_TransferDescriptors[2]->BufferPointer[0]); - DPRINT("TransferDescriptor 2 TotalBytesToTransfer 0x%x\n", m_TransferDescriptors[2]->Token.Bits.TotalBytesToTransfer); - } - + QueueHead->NextPointer = SetupDescriptor->PhysicalAddr; // // store result @@ -789,10 +987,57 @@ *OutHead = QueueHead; // + // displays the current request + // + //DumpQueueHead(QueueHead); + + DPRINT1("BuildControlTransferQueueHead done\n"); + // // done // return STATUS_SUCCESS; } + +VOID +CUSBRequest::DumpQueueHead( + IN PQUEUE_HEAD QueueHead) +{ + PLIST_ENTRY Entry; + PQUEUE_TRANSFER_DESCRIPTOR Descriptor; + ULONG Index = 0; + + DPRINT1("QueueHead %p Addr %x\n", QueueHead, QueueHead->PhysicalAddr); + DPRINT1("QueueHead AlternateNextPointer %x\n", QueueHead->AlternateNextPointer); + DPRINT1("QueueHead NextPointer %x\n", QueueHead->NextPointer); + + Entry = QueueHead->TransferDescriptorListHead.Flink; + while(Entry != &QueueHead->TransferDescriptorListHead) + { + // + // get transfer descriptor + // + Descriptor = (PQUEUE_TRANSFER_DESCRIPTOR)CONTAINING_RECORD(Entry, QUEUE_TRANSFER_DESCRIPTOR, DescriptorEntry); + + DPRINT1("TransferDescriptor %lu Addr %x\n", Index, Descriptor->PhysicalAddr); + DPRINT1("TransferDescriptor %lu Next %x\n", Index, Descriptor->NextPointer); + DPRINT1("TransferDescriptor %lu AlternativeNext %x\n", Index, Descriptor->AlternateNextPointer); + DPRINT1("TransferDescriptor %lu Pid %x\n", Index, Descriptor->Token.Bits.PIDCode); + DPRINT1("TransferDescriptor %lu TotalBytesToTransfer %lu\n", Index, Descriptor->Token.Bits.TotalBytesToTransfer); + DPRINT1("TransferDescriptor %lu InterruptOnComplete %lu\n", Index, Descriptor->Token.Bits.InterruptOnComplete); + + DPRINT1("TransferDescriptor %lu DataToggle %x\n", Index, Descriptor->Token.Bits.DataToggle); + DPRINT1("TransferDescriptor %lu Buffer Pointer 0 %x\n", Index, Descriptor->BufferPointer[0]); + DPRINT1("TransferDescriptor %lu Buffer Pointer 1 %x\n", Index, Descriptor->BufferPointer[1]); + DPRINT1("TransferDescriptor %lu Buffer Pointer 2 %x\n", Index, Descriptor->BufferPointer[2]); + DPRINT1("TransferDescriptor %lu Buffer Pointer 3 %x\n", Index, Descriptor->BufferPointer[3]); + DPRINT1("TransferDescriptor %lu Buffer Pointer 4 %x\n", Index, Descriptor->BufferPointer[4]); + Entry = Entry->Flink; + Index++; + } + + +} + //---------------------------------------------------------------------------------------- NTSTATUS @@ -801,11 +1046,9 @@ { NTSTATUS Status; PQUEUE_HEAD QueueHead; - ULONG TransferDescriptorCount, Index; - ULONG BytesAvailable, BufferIndex; PVOID Base; - ULONG PageOffset, CurrentTransferBufferLength; - UCHAR DataToggle; + ULONG ChainDescriptorLength; + PQUEUE_TRANSFER_DESCRIPTOR FirstDescriptor; // // Allocate the queue head @@ -827,11 +1070,6 @@ PC_ASSERT(m_TransferBufferLength); // - // Max default of 3 descriptors - // - TransferDescriptorCount = 3; - - // // get virtual base of mdl // Base = MmGetSystemAddressForMdlSafe(m_TransferBufferMDL, NormalPagePriority); @@ -845,255 +1083,36 @@ PC_ASSERT(Base); // - // Get the offset from page size - // - PageOffset = BYTE_OFFSET(Base); - - // - // PageOffset should only be > 0 if this is the first transfer for this requests - // - if ((PageOffset != 0) && (m_TransferBufferLengthCompleted != 0)) - { - ASSERT(FALSE); - } - - // - // Calculate the size of this transfer - // - if ((PageOffset != 0) && ((m_TransferBufferLength - m_TransferBufferLengthCompleted) >= (PAGE_SIZE * 4) + PageOffset)) - { - CurrentTransferBufferLength = (PAGE_SIZE * 4) + PageOffset; - } - else if ((m_TransferBufferLength - m_TransferBufferLengthCompleted) >= PAGE_SIZE * 5) - { - CurrentTransferBufferLength = PAGE_SIZE * 5; - } - else - CurrentTransferBufferLength = (m_TransferBufferLength - m_TransferBufferLengthCompleted); - - // - // Add current transfer length to transfer length completed - // - m_TransferBufferLengthCompleted += CurrentTransferBufferLength; - BytesAvailable = CurrentTransferBufferLength; - - DPRINT1("BuildBulkTransferQueueHead\n"); - DPRINT("CurrentTransferBufferLength %x, m_TransferBufferLengthCompleted %x\n", CurrentTransferBufferLength, m_TransferBufferLengthCompleted); - - DPRINT("EndPointAddress %x\n", m_EndpointDescriptor->bEndpointAddress); - DPRINT("EndPointDirection %x\n", USB_ENDPOINT_DIRECTION_IN(m_EndpointDescriptor->bEndpointAddress)); - - DPRINT("Request %p Base Address %p TransferBytesLength %lu MDL %p\n", this, Base, BytesAvailable, m_TransferBufferMDL); - DPRINT("InternalGetPidDirection() %d EndPointAddress %x\n", InternalGetPidDirection(), m_EndpointDescriptor->bEndpointAddress & 0x0F); - DPRINT("Irp %p QueueHead %p\n", m_Irp, QueueHead); - - //PC_ASSERT(InternalGetPidDirection() == USB_ENDPOINT_DIRECTION_IN(m_EndpointDescriptor->bEndpointAddress)); - - // - // DataToggle - // - DataToggle = FALSE; - - // - // Allocated transfer descriptors - // - for (Index = 0; Index < TransferDescriptorCount; Index++) - { - Status = CreateDescriptor(&m_TransferDescriptors[Index]); - if (!NT_SUCCESS(Status)) - { - // - // Failed to allocate transfer descriptors - // - - // - // Free QueueHead - // - FreeQueueHead(QueueHead); - - // - // Free Descriptors - // FIXME: Implement FreeDescriptors - // - return Status; - } - - // - // sanity check - // - PC_ASSERT(BytesAvailable); - - // - // now setup transfer buffers - // - for(BufferIndex = 0; BufferIndex < 5; BufferIndex++) - { - // - // If this is the first buffer of the first descriptor and there is a PageOffset - // - if ((BufferIndex == 0) && (PageOffset != 0) && (Index == 0)) - { - // - // use physical address - // - m_TransferDescriptors[Index]->BufferPointer[0] = MmGetPhysicalAddress(Base).LowPart; - - // - // move to next page - // - Base = (PVOID)ROUND_TO_PAGES(Base); - - // - // increment transfer bytes - // - if (CurrentTransferBufferLength > PAGE_SIZE - PageOffset) - m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer = PAGE_SIZE - PageOffset; - else - m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer = CurrentTransferBufferLength; - - // - // decrement available byte count - // - BytesAvailable -= m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer; - - DPRINT1("TransferDescriptor %p Index %lu BufferPointer %p BufferIndex %lu TotalBytes %lu Remaining %lu\n", m_TransferDescriptors[Index], Index, m_TransferDescriptors[Index]->BufferPointer[BufferIndex], - BufferIndex, m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer, BytesAvailable); - } - else - { - // - // the following pages always start on byte zero of each page - // - PC_ASSERT(((ULONG_PTR)Base & (PAGE_SIZE-1)) == 0); - - if (BytesAvailable >= PAGE_SIZE) - { - // - // store address - // - m_TransferDescriptors[Index]->BufferPointer[BufferIndex] = MmGetPhysicalAddress(Base).LowPart; - - // - // move to next page - // - Base = (PVOID)((ULONG_PTR)Base + PAGE_SIZE); - - // - // increment transfer descriptor bytes - // - m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer += PAGE_SIZE; - - // - // decrement available byte count - // - BytesAvailable -= PAGE_SIZE; - - DPRINT1("TransferDescriptor %p Index %lu BufferPointer %p BufferIndex %lu TotalBytes %lu Remaining %lu\n", m_TransferDescriptors[Index], Index, m_TransferDescriptors[Index]->BufferPointer[BufferIndex], - BufferIndex, m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer, BytesAvailable); - } - else - { - PC_ASSERT(BytesAvailable); - - if (BytesAvailable) - { - // - // store address - // - m_TransferDescriptors[Index]->BufferPointer[BufferIndex] = MmGetPhysicalAddress(Base).LowPart; - - // - // increment transfer descriptor bytes - // - m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer += BytesAvailable; - - // - // decrement available byte count - // - BytesAvailable -= BytesAvailable; - - // - // done as this is the last partial or full page - // - } - DPRINT1("TransferDescriptor %p Index %lu BufferPointer %p BufferIndex %lu TotalBytes %lu Remaining %lu\n", m_TransferDescriptors[Index], Index, m_TransferDescriptors[Index]->BufferPointer[BufferIndex], - BufferIndex, m_TransferDescriptors[Index]->Token.Bits.TotalBytesToTransfer, BytesAvailable); - - break; - } - } - - // - // Check if all bytes have been consumed - // - if (BytesAvailable == 0) - break; - } - - // - // Go ahead and link descriptors - // - if (Index > 0) - { - m_TransferDescriptors[Index - 1]->NextPointer = m_TransferDescriptors[Index]->PhysicalAddr; - } - - - // - // status descriptor - // - m_TransferDescriptors[Index]->Token.Bits.InterruptOnComplete = TRUE; - - // - // FIXME: need status descriptor? - // - - // - // setup direction - // - m_TransferDescriptors[Index]->Token.Bits.PIDCode = InternalGetPidDirection(); - - // - // set data toggle - // - m_TransferDescriptors[Index]->Token.Bits.DataToggle = DataToggle; - DataToggle = !DataToggle; - - // - // Check if all bytes have been consumed - // - if (BytesAvailable == 0) - break; - } - - // - // all bytes should have been consumed - // - PC_ASSERT(BytesAvailable == 0); - - // - // Initialize the QueueHead + // sanity check + // + ASSERT(m_EndpointDescriptor); + + // + // build bulk transfer descriptor chain + // + Status = BuildTransferDescriptorChain(QueueHead, + Base, + m_TransferBufferLength - m_TransferBufferLengthCompleted, + InternalGetPidDirection(), + m_EndpointDescriptor->DataToggle, + &FirstDescriptor, + NULL, + &m_EndpointDescriptor->DataToggle, + &ChainDescriptorLength); + + // + // FIXME: handle errors + // + ASSERT(ChainDescriptorLength == m_TransferBufferLength); + ASSERT(Status == STATUS_SUCCESS); + + // + // init queue head // QueueHead->EndPointCharacteristics.DeviceAddress = GetDeviceAddress(); - - if (m_EndpointDescriptor) - { - // - // Set endpoint address and max packet length - // - QueueHead->EndPointCharacteristics.EndPointNumber = m_EndpointDescriptor->bEndpointAddress & 0x0F; - QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->wMaxPacketSize; - } - - // - // store number of transactions - // - QueueHead->EndPointCapabilities.NumberOfTransactionPerFrame = min(Index, 1); - - // - // link descriptor with queue head - // - QueueHead->NextPointer = m_TransferDescriptors[0]->PhysicalAddr; + QueueHead->EndPointCharacteristics.EndPointNumber = m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress & 0x0F; + QueueHead->EndPointCharacteristics.MaximumPacketLength = m_EndpointDescriptor->EndPointDescriptor.wMaxPacketSize; + QueueHead->NextPointer = FirstDescriptor->PhysicalAddr; // // store result @@ -1176,6 +1195,7 @@ QueueHead->HorizontalLinkPointer = TERMINATE_POINTER; QueueHead->AlternateNextPointer = TERMINATE_POINTER; QueueHead->NextPointer = TERMINATE_POINTER; + InitializeListHead(&QueueHead->TransferDescriptorListHead); // // 1 for non high speed, 0 for high speed device @@ -1536,12 +1556,42 @@ CUSBRequest::FreeQueueHead( IN struct _QUEUE_HEAD * QueueHead) { - LONG DescriptorCount; - - // - // FIXME: support chained queue heads - // - //PC_ASSERT(QueueHead == m_QueueHead); + PLIST_ENTRY Entry; + PQUEUE_TRANSFER_DESCRIPTOR Descriptor; + + do + { + // + // get transfer descriptors + // + Entry = RemoveHeadList(&QueueHead->TransferDescriptorListHead); + ASSERT(Entry); + + // + // obtain descriptor from entry + // + Descriptor = (PQUEUE_TRANSFER_DESCRIPTOR)CONTAINING_RECORD(Entry, QUEUE_TRANSFER_DESCRIPTOR, DescriptorEntry); + + // + // add transfer count + // + m_TotalBytesTransferred += (Descriptor->TotalBytesToTransfer - Descriptor->Token.Bits.TotalBytesToTransfer); + DPRINT1("TotalBytes Transferred in Descriptor %p Length %lu\n", Descriptor, Descriptor->TotalBytesToTransfer - Descriptor->Token.Bits.TotalBytesToTransfer); + + // + // release transfer descriptors + // + m_DmaManager->Release(Descriptor, sizeof(QUEUE_TRANSFER_DESCRIPTOR)); + + }while(!IsListEmpty(&QueueHead->TransferDescriptorListHead)); + + if (m_DescriptorPacket) + { + // + // release packet descriptor + // + m_DmaManager->Release(m_DescriptorPacket, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET)); + } // // release queue head @@ -1549,57 +1599,10 @@ m_DmaManager->Release(QueueHead, sizeof(QUEUE_HEAD)); // - // nullify pointer + // nullify pointers // m_QueueHead = 0; - - // - // release transfer descriptors - // - for (DescriptorCount = 0; DescriptorCount < 3; DescriptorCount++) - { - if (m_TransferDescriptors[DescriptorCount]) - { - // - // Calculate Total Bytes Transferred - // FIXME: Is this the correct method of determine bytes transferred? - // - if (USB_ENDPOINT_TYPE_BULK == GetTransferType()) - { - // - // sanity check - // - ASSERT(m_EndpointDescriptor); - - if (USB_ENDPOINT_DIRECTION_IN(m_EndpointDescriptor->bEndpointAddress)) - { - DPRINT("m_TotalBytesTransferred %x, %x - %x\n", - m_TotalBytesTransferred, - m_TransferDescriptors[DescriptorCount]->TotalBytesToTransfer, - m_TransferDescriptors[DescriptorCount]->Token.Bits.TotalBytesToTransfer); - - m_TotalBytesTransferred += - m_TransferDescriptors[DescriptorCount]->TotalBytesToTransfer - - m_TransferDescriptors[DescriptorCount]->Token.Bits.TotalBytesToTransfer; - } - } - - // - // release transfer descriptors - // - m_DmaManager->Release(m_TransferDescriptors[DescriptorCount], sizeof(QUEUE_TRANSFER_DESCRIPTOR)); - m_TransferDescriptors[DescriptorCount] = 0; - } - } - - if (m_DescriptorPacket) - { - // - // release packet descriptor - // - m_DmaManager->Release(m_DescriptorPacket, sizeof(USB_DEFAULT_PIPE_SETUP_PACKET)); - m_DescriptorPacket = 0; - } + m_DescriptorPacket = 0; } //----------------------------------------------------------------------------------------- @@ -1607,7 +1610,8 @@ CUSBRequest::IsQueueHeadComplete( struct _QUEUE_HEAD * QueueHead) { - ULONG Index; + PLIST_ENTRY Entry; + PQUEUE_TRANSFER_DESCRIPTOR Descriptor; // // first check - is the queue head currently active @@ -1617,39 +1621,46 @@ // // queue head is active (currently processed) // - ASSERT(QueueHead->Token.Bits.Halted == FALSE); - //return FALSE; - } - - // - // FIXME: support chained queue heads - // - for(Index = 0; Index < 3; Index++) - { - // - // check transfer descriptors for completion - // - if (m_TransferDescriptors[Index]) + return FALSE; + } + + if (QueueHead->Token.Bits.Halted) + { + // + // error occured + // + DPRINT1("Found halted queue head %p\n", QueueHead); + ASSERT(FALSE); + return TRUE; + } + + // + // loop list and see if there are any active descriptors + // + Entry = QueueHead->TransferDescriptorListHead.Flink; + while(Entry != &QueueHead->TransferDescriptorListHead) + { + // + // obtain descriptor from entry + // + Descriptor = (PQUEUE_TRANSFER_DESCRIPTOR)CONTAINING_RECORD(Entry, QUEUE_TRANSFER_DESCRIPTOR, DescriptorEntry); + if (Descriptor->Token.Bits.Active) { // - // check for serious error - // - DPRINT("Descriptor Addr %x\n", m_TransferDescriptors[Index]->PhysicalAddr); - DPRINT("Descriptor BabbleDetected %x\n", m_TransferDescriptors[Index]->Token.Bits.BabbleDetected); - DPRINT("Descriptor DataBufferError %x\n", m_TransferDescriptors[Index]->Token.Bits.DataBufferError); - DPRINT("Descriptor DataToggle %x\n", m_TransferDescriptors[Index]->Token.Bits.DataToggle); - DPRINT("Descriptor ErrorCounter %x\n", m_TransferDescriptors[Index]->Token.Bits.ErrorCounter); - DPRINT("Descriptor TransactionError %x\n", m_TransferDescriptors[Index]->Token.Bits.TransactionError); - - - // - // the transfer descriptor should be in the same state as the queue head - // - //PC_ASSERT(m_TransferDescriptors[Index]->Token.Bits.Active == 0); + // descriptor is still active + // + return FALSE; } - } - //ASSERT(FALSE); - + + // + // move to next entry + // + Entry = Entry->Flink; + } + + // + // no active descriptors found, queue head is finished + // return TRUE; } @@ -1682,8 +1693,7 @@ // sanity check // ASSERT(m_EndpointDescriptor); - - if (USB_ENDPOINT_DIRECTION_IN(m_EndpointDescriptor->bEndpointAddress)) + if (USB_ENDPOINT_DIRECTION_IN(m_EndpointDescriptor->EndPointDescriptor.bEndpointAddress)) { // // bulk in request Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/usbehci.h URL:
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/u…
============================================================================== --- branches/usb-bringup-trunk/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] (original) +++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/usbehci.h [iso-8859-1] Tue Feb 7 21:48:05 2012 @@ -38,6 +38,28 @@ #define C_PORT_SUSPEND 18 #define C_PORT_OVER_CURRENT 19 #define C_PORT_RESET 20 + +typedef struct _USB_ENDPOINT +{ + USB_ENDPOINT_DESCRIPTOR EndPointDescriptor; + UCHAR HubAddress; + UCHAR HubPort; + UCHAR DataToggle; +} USB_ENDPOINT, *PUSB_ENDPOINT; + +typedef struct _USB_INTERFACE +{ + USB_INTERFACE_DESCRIPTOR InterfaceDescriptor; + USB_ENDPOINT *EndPoints; +} USB_INTERFACE, *PUSB_INTERFACE; + +typedef struct _USB_CONFIGURATION +{ + USB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor; + USB_INTERFACE *Interfaces; +} USB_CONFIGURATION, *PUSB_CONFIGURATION; + + typedef struct {
12 years, 10 months
1
0
0
0
[pschweitzer] 55488: [RAPPS] Fix French translation encoding
by pschweitzer@svn.reactos.org
Author: pschweitzer Date: Tue Feb 7 20:40:00 2012 New Revision: 55488 URL:
http://svn.reactos.org/svn/reactos?rev=55488&view=rev
Log: [RAPPS] Fix French translation encoding Modified: trunk/reactos/base/applications/rapps/lang/fr-FR.rc Modified: trunk/reactos/base/applications/rapps/lang/fr-FR.rc URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/rapps/la…
============================================================================== --- trunk/reactos/base/applications/rapps/lang/fr-FR.rc [iso-8859-1] (original) +++ trunk/reactos/base/applications/rapps/lang/fr-FR.rc [iso-8859-1] Tue Feb 7 20:40:00 2012 @@ -21,7 +21,7 @@ POPUP "Aide" BEGIN MENUITEM "Aide", ID_HELP, GRAYED - MENUITEM "Å propos", ID_ABOUT + MENUITEM "à propos", ID_ABOUT END END @@ -54,15 +54,15 @@ FONT 8, "MS Shell Dlg" BEGIN GROUPBOX "Général", -1, 4, 2, 240, 61 - AUTOCHECKBOX "&Enregistrer la position de la fenÄtre", IDC_SAVE_WINDOW_POS, 15, 12, 219, 12 - AUTOCHECKBOX "&Mettre Å jour la liste des programmes accessibles au démarage", IDC_UPDATE_AVLIST, 15, 29, 222, 12 + AUTOCHECKBOX "&Enregistrer la position de la fenêtre", IDC_SAVE_WINDOW_POS, 15, 12, 219, 12 + AUTOCHECKBOX "&Mettre à jour la liste des programmes accessibles au démarage", IDC_UPDATE_AVLIST, 15, 29, 222, 12 AUTOCHECKBOX "&Journal de l'installation de la suppression des programmes", IDC_LOG_ENABLED, 15, 46, 219, 12 GROUPBOX "Téléchargement", -1, 4, 65, 240, 51 LTEXT "Fichier des téléchargements :", -1, 16, 75, 100, 9 EDITTEXT IDC_DOWNLOAD_DIR_EDIT, 15, 86, 166, 12, WS_CHILD | WS_VISIBLE | WS_GROUP PUSHBUTTON "&Sélectionner", IDC_CHOOSE, 187, 85, 50, 14 - AUTOCHECKBOX "&Supprimer l'installateur du programme aprÄs l'installation", IDC_DEL_AFTER_INSTALL, 16, 100, 218, 12 + AUTOCHECKBOX "&Supprimer l'installateur du programme après l'installation", IDC_DEL_AFTER_INSTALL, 16, 100, 218, 12 PUSHBUTTON "Par défaut", IDC_DEFAULT_SETTINGS, 8, 124, 60, 14 PUSHBUTTON "Accepter", IDOK, 116, 124, 60, 14 @@ -76,7 +76,7 @@ BEGIN LTEXT "...", IDC_INSTALL_TEXT, 4, 5, 209, 35 - AUTORADIOBUTTON "&Installer Å partir d'un disque (CD ou DVD)", IDC_CD_INSTALL, 10, 46, 197, 11, WS_GROUP + AUTORADIOBUTTON "&Installer à partir d'un disque (CD ou DVD)", IDC_CD_INSTALL, 10, 46, 197, 11, WS_GROUP AUTORADIOBUTTON "&Télécharger et installer", IDC_DOWNLOAD_INSTALL, 10, 59, 197, 11, NOT WS_TABSTOP PUSHBUTTON "Accepter", IDOK, 86, 78, 60, 14 @@ -95,7 +95,7 @@ IDD_ABOUT_DIALOG DIALOGEX 22, 16, 190, 66 STYLE DS_SHELLFONT | WS_BORDER | WS_DLGFRAME | WS_SYSMENU | DS_MODALFRAME -CAPTION "Å propos" +CAPTION "à propos" FONT 8, "MS Shell Dlg" BEGIN LTEXT "ReactOS Applications Manager\nCopyright (C) 2009\npar Dmitry Chapyshev (dmitry(a)reactos.org)", IDC_STATIC, 48, 7, 130, 39 @@ -131,13 +131,13 @@ IDS_INFO_REGOWNER "\nUtilisateur enregistré : " IDS_INFO_PRODUCTID "\nID du produit : " IDS_INFO_CONTACT "\nContact : " - IDS_INFO_UPDATEINFO "\nInformation de mise Å jour : " - IDS_INFO_INFOABOUT "\nInformation Å propos : " + IDS_INFO_UPDATEINFO "\nInformation de mise à jour : " + IDS_INFO_INFOABOUT "\nInformation à propos : " IDS_INFO_COMMENTS "\nCommentaires : " IDS_INFO_INSTLOCATION "\nEmplacement de l'installation : " IDS_INFO_INSTALLSRC "\nSource de l'installation : " IDS_INFO_UNINSTALLSTR "\nCommande de désinstallation : " - IDS_INFO_MODIFYPATH "\nModifier le chemin d'accÄs : " + IDS_INFO_MODIFYPATH "\nModifier le chemin d'accès : " IDS_INFO_INSTALLDATE "\nDate d'installation : " END @@ -161,7 +161,7 @@ IDS_CAT_GAMES "Jeux & détente" IDS_CAT_GRAPHICS "Graphismes" IDS_CAT_INTERNET "Internet & résaux" - IDS_CAT_LIBS "BibliothÄques" + IDS_CAT_LIBS "Bibliothèques" IDS_CAT_OFFICE "Bureautique" IDS_CAT_OTHER "Autres" IDS_CAT_SCIENCE "Sciences" @@ -177,17 +177,17 @@ IDS_UNINSTALL "Désinstaller" IDS_MODIFY "Modifier" IDS_APPS_COUNT "Nombre d'applications : %d" - IDS_WELCOME_TITLE "Bienvenue Å ReactOS Applications Manager!\n\n" - IDS_WELCOME_TEXT "Choisisez une catégorie Å gauche, ensuite choisisez une application Å installer ou désinstaller.\nSite internet de ReactOS : " + IDS_WELCOME_TITLE "Bienvenue à ReactOS Applications Manager!\n\n" + IDS_WELCOME_TEXT "Choisisez une catégorie à gauche, ensuite choisisez une application à installer ou désinstaller.\nSite internet de ReactOS : " IDS_WELCOME_URL "
http://www.reactos.org
" IDS_INSTALLED "Installé" IDS_AVAILABLEFORINST "Disponible pour installation" - IDS_UPDATES "Mises Å jour" + IDS_UPDATES "Mises à jour" IDS_APPLICATIONS "Applications" IDS_CHOOSE_FOLDER_TEXT "Choisisez un dossier dans lequel seront téléchargés les programmes :" IDS_CHOOSE_FOLDER_ERROR "Le dossier que vous avez spécifié n'existe pas. Le créer ?" - IDS_USER_NOT_ADMIN "Vous devez Ätre un administrateur pour démarrer ""ReactOS Applications Manager""!" - IDS_APP_REG_REMOVE "Etes-vous sűr de vouloir supprimer les données du programme installé du registre ?" + IDS_USER_NOT_ADMIN "Vous devez être un administrateur pour démarrer ""ReactOS Applications Manager""!" + IDS_APP_REG_REMOVE "Etes-vous sûr de vouloir supprimer les données du programme installé du registre ?" IDS_INFORMATION "Information" IDS_UNABLE_TO_REMOVE "Impossible de supprimer les données du programme du registre !" END
12 years, 10 months
1
0
0
0
[tkreuzer] 55487: [CRT] Fix 64 bit build of MSVCRT
by tkreuzer@svn.reactos.org
Author: tkreuzer Date: Tue Feb 7 18:09:25 2012 New Revision: 55487 URL:
http://svn.reactos.org/svn/reactos?rev=55487&view=rev
Log: [CRT] Fix 64 bit build of MSVCRT Modified: trunk/reactos/lib/sdk/crt/time/bitsfixup.h Modified: trunk/reactos/lib/sdk/crt/time/bitsfixup.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/time/bitsfixup…
============================================================================== --- trunk/reactos/lib/sdk/crt/time/bitsfixup.h [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/time/bitsfixup.h [iso-8859-1] Tue Feb 7 18:09:25 2012 @@ -10,12 +10,13 @@ #undef _timeb #undef _ftime #undef _tctime -#undef _ftime_s #undef _tctime_s #undef _tutime #else #define _time time #endif + +#undef _ftime_s #ifdef _USE_EXPLICIT_32BIT_TIME #define time_t __time32_t
12 years, 10 months
1
0
0
0
← Newer
1
...
42
43
44
45
46
47
48
...
58
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
Results per page:
10
25
50
100
200