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
2025
January
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
November 2007
----- 2025 -----
January 2025
----- 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
20 participants
888 discussions
Start a n
N
ew thread
[cwittich] 30599: limit length of szValue to LF_FACESIZE to prevent a buffer overflow initialize szValue
by cwittich@svn.reactos.org
Author: cwittich Date: Tue Nov 20 19:05:59 2007 New Revision: 30599 URL:
http://svn.reactos.org/svn/reactos?rev=30599&view=rev
Log: limit length of szValue to LF_FACESIZE to prevent a buffer overflow initialize szValue Modified: trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c Modified: trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/csrss/win…
============================================================================== --- trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c (original) +++ trunk/reactos/subsystems/win32/csrss/win32csr/guiconsole.c Tue Nov 20 19:05:59 2007 @@ -506,7 +506,7 @@ DWORD dwValue; DWORD dwType; WCHAR szValueName[MAX_PATH]; - WCHAR szValue[MAX_PATH]; + WCHAR szValue[LF_FACESIZE] = L"\0"; DWORD Value; if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL, &dwNumSubKeys, NULL, NULL, NULL, NULL) != ERROR_SUCCESS) @@ -530,7 +530,7 @@ * retry in case of string value */ dwValue = sizeof(szValue); - dwValueName = MAX_PATH; + dwValueName = LF_FACESIZE; if (RegEnumValueW(hKey, dwIndex, szValueName, &dwValueName, NULL, NULL, (BYTE*)szValue, &dwValue) != ERROR_SUCCESS) break; }
17 years, 1 month
1
0
0
0
[cwittich] 30598: define DDDKAPI - it isn't defined in WDK
by cwittich@svn.reactos.org
Author: cwittich Date: Tue Nov 20 18:42:29 2007 New Revision: 30598 URL:
http://svn.reactos.org/svn/reactos?rev=30598&view=rev
Log: define DDDKAPI - it isn't defined in WDK Modified: trunk/reactos/tools/rbuild/backend/msbuild/msbuild.cpp Modified: trunk/reactos/tools/rbuild/backend/msbuild/msbuild.cpp URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/msbui…
============================================================================== --- trunk/reactos/tools/rbuild/backend/msbuild/msbuild.cpp (original) +++ trunk/reactos/tools/rbuild/backend/msbuild/msbuild.cpp Tue Nov 20 18:42:29 2007 @@ -156,7 +156,7 @@ fprintf ( OUT, "\r\nMSC_WARNING_LEVEL=/W3 /WX\r\n\r\n" ); /* Disable deprecated function uage warnings */ - fprintf ( OUT, "C_DEFINES=$(C_DEFINES) /wd4996\r\n" ); + fprintf ( OUT, "C_DEFINES=$(C_DEFINES) /DDDKAPI=__stdcall /wd4996\r\n" ); /* includes */
17 years, 1 month
1
0
0
0
[cwittich] 30597: use ExAllocatePoolWithTag instead of ExAllocatePool
by cwittich@svn.reactos.org
Author: cwittich Date: Tue Nov 20 18:26:17 2007 New Revision: 30597 URL:
http://svn.reactos.org/svn/reactos?rev=30597&view=rev
Log: use ExAllocatePoolWithTag instead of ExAllocatePool Modified: trunk/reactos/drivers/filesystems/vfat/create.c trunk/reactos/drivers/filesystems/vfat/dir.c trunk/reactos/drivers/filesystems/vfat/dirwr.c trunk/reactos/drivers/filesystems/vfat/fsctl.c trunk/reactos/drivers/filesystems/vfat/vfat.h Modified: trunk/reactos/drivers/filesystems/vfat/create.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/c…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/create.c (original) +++ trunk/reactos/drivers/filesystems/vfat/create.c Tue Nov 20 18:26:17 2007 @@ -201,7 +201,7 @@ DPRINT ("FindFile: Path %wZ)\n",&Parent->PathNameU); PathNameBufferLength = LONGNAME_MAX_LENGTH * sizeof(WCHAR); - PathNameBuffer = ExAllocatePool(NonPagedPool, PathNameBufferLength + sizeof(WCHAR)); + PathNameBuffer = ExAllocatePoolWithTag(NonPagedPool, PathNameBufferLength + sizeof(WCHAR), TAG_VFAT); if (!PathNameBuffer) { CHECKPOINT1; Modified: trunk/reactos/drivers/filesystems/vfat/dir.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/d…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/dir.c (original) +++ trunk/reactos/drivers/filesystems/vfat/dir.c Tue Nov 20 18:26:17 2007 @@ -351,7 +351,7 @@ { FirstQuery = TRUE; pCcb->SearchPattern.MaximumLength = pSearchPattern->Length + sizeof(WCHAR); - pCcb->SearchPattern.Buffer = ExAllocatePool(NonPagedPool, pCcb->SearchPattern.MaximumLength); + pCcb->SearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool, pCcb->SearchPattern.MaximumLength, TAG_VFAT); if (!pCcb->SearchPattern.Buffer) { ExReleaseResourceLite(&pFcb->MainResource); @@ -365,7 +365,7 @@ { FirstQuery = TRUE; pCcb->SearchPattern.MaximumLength = 2 * sizeof(WCHAR); - pCcb->SearchPattern.Buffer = ExAllocatePool(NonPagedPool, 2 * sizeof(WCHAR)); + pCcb->SearchPattern.Buffer = ExAllocatePoolWithTag(NonPagedPool, 2 * sizeof(WCHAR), TAG_VFAT); if (!pCcb->SearchPattern.Buffer) { ExReleaseResourceLite(&pFcb->MainResource); Modified: trunk/reactos/drivers/filesystems/vfat/dirwr.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/d…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/dirwr.c (original) +++ trunk/reactos/drivers/filesystems/vfat/dirwr.c Tue Nov 20 18:26:17 2007 @@ -219,7 +219,7 @@ nbSlots = (DirContext.LongNameU.Length / sizeof(WCHAR) + 12) / 13 + 1; //nb of entry needed for long name+normal entry DPRINT ("NameLen= %d, nbSlots =%d\n", DirContext.LongNameU.Length / sizeof(WCHAR), nbSlots); - Buffer = ExAllocatePool (NonPagedPool, (nbSlots - 1) * sizeof (FAT_DIR_ENTRY)); + Buffer = ExAllocatePoolWithTag (NonPagedPool, (nbSlots - 1) * sizeof (FAT_DIR_ENTRY), TAG_VFAT); if (Buffer == NULL) { return STATUS_INSUFFICIENT_RESOURCES; Modified: trunk/reactos/drivers/filesystems/vfat/fsctl.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/f…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/fsctl.c (original) +++ trunk/reactos/drivers/filesystems/vfat/fsctl.c Tue Nov 20 18:26:17 2007 @@ -133,7 +133,7 @@ if (*RecognizedFS) { - Boot = ExAllocatePool(NonPagedPool, DiskGeometry.BytesPerSector); + Boot = ExAllocatePoolWithTag(NonPagedPool, DiskGeometry.BytesPerSector, TAG_VFAT); if (Boot == NULL) { return STATUS_INSUFFICIENT_RESOURCES; @@ -257,7 +257,7 @@ if (!*RecognizedFS && PartitionInfoIsValid) { - BootFatX = ExAllocatePool(NonPagedPool, sizeof(struct _BootSectorFatX)); + BootFatX = ExAllocatePoolWithTag(NonPagedPool, sizeof(struct _BootSectorFatX), TAG_VFAT); if (BootFatX == NULL) { *RecognizedFS=FALSE; Modified: trunk/reactos/drivers/filesystems/vfat/vfat.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/v…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/vfat.h (original) +++ trunk/reactos/drivers/filesystems/vfat/vfat.h Tue Nov 20 18:26:17 2007 @@ -413,6 +413,7 @@ #define TAG_CCB TAG('V', 'C', 'C', 'B') #define TAG_FCB TAG('V', 'F', 'C', 'B') #define TAG_IRP TAG('V', 'I', 'R', 'P') +#define TAG_VFAT TAG('V', 'F', 'A', 'T') #define ENTRIES_PER_SECTOR (BLOCKSIZE / sizeof(FATDirEntry))
17 years, 1 month
1
0
0
0
[fireball] 30596: - Add roothub status operations. - Ports count is correctly detected now. - Added all necessary stubs for HCD interface, so that usbdriver can work further.
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 18:16:16 2007 New Revision: 30596 URL:
http://svn.reactos.org/svn/reactos?rev=30596&view=rev
Log: - Add roothub status operations. - Ports count is correctly detected now. - Added all necessary stubs for HCD interface, so that usbdriver can work further. Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c Tue Nov 20 18:16:16 2007 @@ -39,8 +39,13 @@ // shared with EHCI NTSTATUS ehci_dispatch_irp(IN PDEVICE_OBJECT DeviceObject, IN PIRP irp); +PUSB_DEV_MANAGER ehci_get_dev_mgr(PHCD hcd); VOID ehci_set_dev_mgr(PHCD hcd, PUSB_DEV_MANAGER dev_mgr); VOID ehci_set_id(PHCD hcd, UCHAR id); +UCHAR ehci_get_id(PHCD hcd); +UCHAR ehci_alloc_addr(PHCD hcd); +VOID ehci_free_addr(PHCD hcd, UCHAR addr); + BOOLEAN NTAPI ehci_cal_cpu_freq(PVOID context); extern USB_DEV_MANAGER g_dev_mgr; @@ -56,6 +61,31 @@ #define OHCI_WRITE_PORT_UCHAR( pch, src ) ( *pch = ( UCHAR )src ) #define OHCI_READ_PORT_USHORT( psh ) ( *psh ) #define OHCI_WRITE_PORT_USHORT( psh, src ) ( *psh = ( USHORT )src ) + +/* AMD-756 (D2 rev) reports corrupt register contents in some cases. + * The erratum (#4) description is incorrect. AMD's workaround waits + * till some bits (mostly reserved) are clear; ok for all revs. + */ +#define read_roothub(hc, register, mask) ({ \ + ULONG temp = OHCI_READ_PORT_ULONG(&((hc)->regs->roothub.register)); \ + if (temp == -1) \ + /*disable (hc)*/; \ + /*else if (hc->flags & OHCI_QUIRK_AMD756) \ + while (temp & mask) \ + temp = ohci_readl (hc, &hc->regs->roothub.register); */ \ + temp; }) + +static ULONG roothub_a (POHCI_DEV hc) + { return read_roothub (hc, a, 0xfc0fe000); } +/* +static inline u32 roothub_b (struct ohci_hcd *hc) + { return ohci_readl (hc, &hc->regs->roothub.b); } +static inline u32 roothub_status (struct ohci_hcd *hc) + { return ohci_readl (hc, &hc->regs->roothub.status); } +static u32 roothub_portstatus (struct ohci_hcd *hc, int i) + { return read_roothub (hc, portstatus [i], 0xffe0fce0); } +*/ + VOID ohci_wait_ms(POHCI_DEV ohci, LONG ms) @@ -261,6 +291,7 @@ //before we connect the interrupt, we have to init ohci pdev_ext->ohci->pdev_ext = pdev_ext; + pdev_ext->ohci->regs = (POHCI_REGS)pdev_ext->ohci->port_base; KeInitializeTimer(&pdev_ext->ohci->reset_timer); @@ -292,6 +323,23 @@ //ohci_usb_reset (ohci); } + /* Disable HC interrupts */ + OHCI_WRITE_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_INTRDISABLE), OHCI_INTR_MIE); + // flush the writes + (VOID)OHCI_READ_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_CONTROL)); + + /* Read the number of ports unless overridden */ + pdev_ext->ohci->num_ports = roothub_a(pdev_ext->ohci) & RH_A_NDP; + + DbgPrint("OHCI: %d ports\n", pdev_ext->ohci->num_ports); + + //ohci->hcca = dma_alloc_coherent (ohci_to_hcd(ohci)->self.controller, + // sizeof *ohci->hcca, &ohci->hcca_dma, 0); + //if (!ohci->hcca) + // return -ENOMEM; + + //if ((ret = ohci_mem_init (ohci)) < 0) + // ohci_stop (ohci_to_hcd(ohci)); #if 0 //init ehci_caps @@ -413,30 +461,217 @@ return pdev; } +BOOLEAN +ohci_start(PHCD hcd) +{ + //ULONG tmp; + //PBYTE base; + //PEHCI_USBCMD_CONTENT usbcmd; + //POHCI_DEV ohci; + + if (hcd == NULL) + return FALSE; + + return TRUE; +#if 0 + ehci = struct_ptr(hcd, EHCI_DEV, hcd_interf); + base = ehci->port_base; + + // stop the controller + tmp = EHCI_READ_PORT_ULONG((PULONG) (base + EHCI_USBCMD)); + usbcmd = (PEHCI_USBCMD_CONTENT) & tmp; + usbcmd->run_stop = 0; + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBCMD), tmp); + + // wait the controller stop( ehci spec, 16 microframe ) + usb_wait_ms_dpc(2); + + // reset the controller + usbcmd = (PEHCI_USBCMD_CONTENT) & tmp; + usbcmd->hcreset = TRUE; + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBCMD), tmp); + + for(;;) + { + // interval.QuadPart = -100 * 10000; // 10 ms + // KeDelayExecutionThread( KernelMode, FALSE, &interval ); + KeStallExecutionProcessor(10); + tmp = EHCI_READ_PORT_ULONG((PULONG) (base + EHCI_USBCMD)); + if (!usbcmd->hcreset) + break; + } + + // prepare the registers + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_CTRLDSSEGMENT), 0); + + // turn on all the int + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBINTR), + EHCI_USBINTR_INTE | EHCI_USBINTR_ERR | EHCI_USBINTR_ASYNC | EHCI_USBINTR_HSERR + // EHCI_USBINTR_FLROVR | \ // it is noisy + // EHCI_USBINTR_PC // we detect it by polling + ); + // write the list base reg + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_PERIODICLISTBASE), ehci->frame_list_phys_addr.LowPart); + + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_ASYNCLISTBASE), ehci->skel_async_qh->phys_addr & ~(0x1f)); + + usbcmd->int_threshold = 1; + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBCMD), tmp); + + // let's rock + usbcmd->run_stop = 1; + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBCMD), tmp); + + // set the configuration flag + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_CONFIGFLAG), 1); + + // enable the list traversaling + usbcmd->async_enable = 1; + usbcmd->periodic_enable = 1; + EHCI_WRITE_PORT_ULONG((PULONG) (base + EHCI_USBCMD), tmp); +#endif + return TRUE; +} + + +ULONG +ohci_get_type(PHCD hcd) +{ + return HCD_TYPE_OHCI; // ( hcd->flags & HCD_TYPE_MASK ); +} + +NTSTATUS +ohci_submit_urb2(PHCD hcd, PUSB_DEV pdev, PUSB_ENDPOINT pendp, PURB purb) +{ + return STATUS_UNSUCCESSFUL; +} + +PUSB_DEV +ohci_get_root_hub(PHCD hcd) +{ + return ohci_from_hcd(hcd)->root_hub; +} + +VOID +ohci_set_root_hub(PHCD hcd, PUSB_DEV root_hub) +{ + if (hcd == NULL || root_hub == NULL) + return; + ohci_from_hcd(hcd)->root_hub = root_hub; + return; +} + +BOOLEAN +ohci_remove_device2(PHCD hcd, PUSB_DEV pdev) +{ + if (hcd == NULL || pdev == NULL) + return FALSE; + + return FALSE; + //return ehci_remove_device(ehci_from_hcd(hcd), pdev); +} + +BOOLEAN +ohci_hcd_release(PHCD hcd) +{ + POHCI_DEV ohci; + POHCI_DEVICE_EXTENSION pdev_ext; + + if (hcd == NULL) + return FALSE; + + ohci = ohci_from_hcd(hcd); + pdev_ext = ohci->pdev_ext; + return FALSE;//ehci_release(pdev_ext->pdev_obj); +} + +NTSTATUS +ohci_cancel_urb2(PHCD hcd, PUSB_DEV pdev, PUSB_ENDPOINT pendp, PURB purb) +{ + POHCI_DEV ohci; + if (hcd == NULL) + return STATUS_INVALID_PARAMETER; + + ohci = ohci_from_hcd(hcd); + return STATUS_UNSUCCESSFUL;//ehci_cancel_urb(ehci, pdev, pendp, purb); +} + +VOID +ohci_generic_urb_completion(PURB purb, PVOID context) +{ +} + +BOOLEAN +ohci_rh_reset_port(PHCD hcd, UCHAR port_idx) +{ + //ULONG i; + POHCI_DEV ohci; + //ULONG status; + //UCHAR port_count; + + if (hcd == NULL) + return FALSE; + + ohci = ohci_from_hcd(hcd); + //port_count = (UCHAR) ((PEHCI_HCS_CONTENT) & ehci->ehci_caps.hcs_params)->port_count; + + //if (port_idx < 1 || port_idx > port_count) + // return FALSE; + + //usb_dbg_print(DBGLVL_MAXIMUM, ("ohci_rh_reset_port(): status after written=0x%x\n", status)); + return TRUE; +} + +NTSTATUS +ohci_hcd_dispatch(PHCD hcd, LONG disp_code, PVOID param) +{ + POHCI_DEV ohci; + + if (hcd == NULL) + return STATUS_INVALID_PARAMETER; + ohci = ohci_from_hcd(hcd); +#if 0 + switch (disp_code) + { + case HCD_DISP_READ_PORT_COUNT: + { + if (param == NULL) + return STATUS_INVALID_PARAMETER; + *((PUCHAR) param) = (UCHAR) HCS_N_PORTS(ehci->ehci_caps.hcs_params); + return STATUS_SUCCESS; + } + case HCD_DISP_READ_RH_DEV_CHANGE: + { + if (ehci_rh_get_dev_change(hcd, param) == FALSE) + return STATUS_INVALID_PARAMETER; + return STATUS_SUCCESS; + } + } +#endif + return STATUS_NOT_IMPLEMENTED; +} + VOID ohci_init_hcd_interface(POHCI_DEV ohci) { ohci->hcd_interf.hcd_set_dev_mgr = ehci_set_dev_mgr; -#if 0 ohci->hcd_interf.hcd_get_dev_mgr = ehci_get_dev_mgr; - ohci->hcd_interf.hcd_get_type = ehci_get_type; -#endif + ohci->hcd_interf.hcd_get_type = ohci_get_type; ohci->hcd_interf.hcd_set_id = ehci_set_id; -#if 0 ohci->hcd_interf.hcd_get_id = ehci_get_id; ohci->hcd_interf.hcd_alloc_addr = ehci_alloc_addr; ohci->hcd_interf.hcd_free_addr = ehci_free_addr; - ohci->hcd_interf.hcd_submit_urb = ehci_submit_urb2; - ohci->hcd_interf.hcd_generic_urb_completion = ehci_generic_urb_completion; - ohci->hcd_interf.hcd_get_root_hub = ehci_get_root_hub; - ohci->hcd_interf.hcd_set_root_hub = ehci_set_root_hub; - ohci->hcd_interf.hcd_remove_device = ehci_remove_device2; - ohci->hcd_interf.hcd_rh_reset_port = ehci_rh_reset_port; - ohci->hcd_interf.hcd_release = ehci_hcd_release; - ohci->hcd_interf.hcd_cancel_urb = ehci_cancel_urb2; - ohci->hcd_interf.hcd_start = ehci_start; - ohci->hcd_interf.hcd_dispatch = ehci_hcd_dispatch; -#endif + ohci->hcd_interf.hcd_submit_urb = ohci_submit_urb2; + ohci->hcd_interf.hcd_generic_urb_completion = ohci_generic_urb_completion; + ohci->hcd_interf.hcd_get_root_hub = ohci_get_root_hub; + ohci->hcd_interf.hcd_set_root_hub = ohci_set_root_hub; + ohci->hcd_interf.hcd_remove_device = ohci_remove_device2; + ohci->hcd_interf.hcd_rh_reset_port = ohci_rh_reset_port; + ohci->hcd_interf.hcd_release = ohci_hcd_release; + ohci->hcd_interf.hcd_cancel_urb = ohci_cancel_urb2; + ohci->hcd_interf.hcd_start = ohci_start; + ohci->hcd_interf.hcd_dispatch = ohci_hcd_dispatch; + ohci->hcd_interf.flags = HCD_TYPE_OHCI; //hcd types | hcd id } Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Tue Nov 20 18:16:16 2007 @@ -119,7 +119,7 @@ * You must use readl() and writel() (in <asm/io.h>) to access these fields!! * Layout is in section 7 (and appendix B) of the spec. */ -struct _OHCI_REGS +typedef struct _OHCI_REGS { /* control and status registers (section 7.1) */ ULONG revision; @@ -164,6 +164,9 @@ PHYSICAL_ADDRESS ohci_reg_base; // io space BOOLEAN port_mapped; PBYTE port_base; // note: added by ehci_caps.length, operational regs base addr, not the actural base + struct _OHCI_REGS *regs; + + USHORT num_ports; KTIMER reset_timer; //used to reset the host controller struct _OHCI_DEVICE_EXTENSION *pdev_ext; @@ -193,6 +196,6 @@ KDPC ohci_dpc; } OHCI_DEVICE_EXTENSION, *POHCI_DEVICE_EXTENSION; - +#define ohci_from_hcd( hCD ) ( struct_ptr( ( hCD ), OHCI_DEV, hcd_interf ) ) #endif /* __OHCI_H__ */
17 years, 1 month
1
0
0
0
[fireball] 30595: - Further develop OHCI init code (based on linux-2.6.14.3).
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 16:51:59 2007 New Revision: 30595 URL:
http://svn.reactos.org/svn/reactos?rev=30595&view=rev
Log: - Further develop OHCI init code (based on linux-2.6.14.3). Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c Tue Nov 20 16:51:59 2007 @@ -45,6 +45,33 @@ extern USB_DEV_MANAGER g_dev_mgr; + +#define OHCI_READ_PORT_ULONG( pul ) ( *pul ) +#define OHCI_WRITE_PORT_ULONG( pul, src ) \ +{\ + *pul = ( ULONG )src;\ +} + +#define OHCI_READ_PORT_UCHAR( pch ) ( *pch ) +#define OHCI_WRITE_PORT_UCHAR( pch, src ) ( *pch = ( UCHAR )src ) +#define OHCI_READ_PORT_USHORT( psh ) ( *psh ) +#define OHCI_WRITE_PORT_USHORT( psh, src ) ( *psh = ( USHORT )src ) + +VOID +ohci_wait_ms(POHCI_DEV ohci, LONG ms) +{ + LARGE_INTEGER lms; + if (ms <= 0) + return; + + lms.QuadPart = -10 * ms; + KeSetTimer(&ohci->reset_timer, lms, NULL); + + KeWaitForSingleObject(&ohci->reset_timer, Executive, KernelMode, FALSE, NULL); + + return; +} + PDEVICE_OBJECT ohci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER dev_mgr) { @@ -98,7 +125,7 @@ if (pdev_ext) { // acquire higher irql to eliminate pre-empty - KeSynchronizeExecution(pdev_ext->ohci_int, ehci_cal_cpu_freq, NULL); + //KeSynchronizeExecution(pdev_ext->ohci_int, ehci_cal_cpu_freq, NULL); } } return NULL; @@ -234,6 +261,38 @@ //before we connect the interrupt, we have to init ohci pdev_ext->ohci->pdev_ext = pdev_ext; + + KeInitializeTimer(&pdev_ext->ohci->reset_timer); + + // take it over from SMM/BIOS/whoever has it + if (OHCI_READ_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_CONTROL)) & OHCI_CTRL_IR) + { + ULONG temp; + + DbgPrint("USB HC TakeOver from BIOS/SMM\n"); + + /* this timeout is arbitrary. we make it long, so systems + * depending on usb keyboards may be usable even if the + * BIOS/SMM code seems pretty broken. + */ + temp = 500; /* arbitrary: five seconds */ + + OHCI_WRITE_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_INTRENABLE), OHCI_INTR_OC); + OHCI_WRITE_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_CMDSTATUS), OHCI_OCR); + + while (OHCI_READ_PORT_ULONG((PULONG)(pdev_ext->ohci->port_base + OHCI_CONTROL)) & OHCI_CTRL_IR) + { + ohci_wait_ms(pdev_ext->ohci, 10); + if (--temp == 0) { + DbgPrint("USB HC takeover failed!" + " (BIOS/SMM bug)\n"); + return NULL; + } + } + //ohci_usb_reset (ohci); + } + + #if 0 //init ehci_caps // i = ( ( PEHCI_HCS_CONTENT )( &pdev_ext->ehci->ehci_caps.hcs_params ) )->length; @@ -258,8 +317,6 @@ &pdev_ext->ehci->pending_endp_list)); init_pending_endp_pool(&pdev_ext->ehci->pending_endp_pool); - - KeInitializeTimer(&pdev_ext->ehci->reset_timer); vector = HalGetInterruptVector(PCIBus, bus, Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Tue Nov 20 16:51:59 2007 @@ -20,6 +20,142 @@ #define OHCI_DEVICE_NAME "\\Device\\OHCI" #define OHCI_DOS_DEVICE_NAME "\\DosDevices\\OHCI" + +/* Host Controller Operational Registers */ + +#define OHCI_REVISION 0x0 +#define OHCI_CONTROL 0x4 +#define OHCI_CMDSTATUS 0x8 +#define OHCI_INTRSTATUS 0xc +#define OHCI_INTRENABLE 0x10 +#define OHCI_INTRDISABLE 0x14 + +/* OHCI CONTROL AND STATUS REGISTER MASKS */ + +/* + * HcControl (control) register masks + */ +#define OHCI_CTRL_CBSR (3 << 0) /* control/bulk service ratio */ +#define OHCI_CTRL_PLE (1 << 2) /* periodic list enable */ +#define OHCI_CTRL_IE (1 << 3) /* isochronous enable */ +#define OHCI_CTRL_CLE (1 << 4) /* control list enable */ +#define OHCI_CTRL_BLE (1 << 5) /* bulk list enable */ +#define OHCI_CTRL_HCFS (3 << 6) /* host controller functional state */ +#define OHCI_CTRL_IR (1 << 8) /* interrupt routing */ +#define OHCI_CTRL_RWC (1 << 9) /* remote wakeup connected */ +#define OHCI_CTRL_RWE (1 << 10) /* remote wakeup enable */ + +/* pre-shifted values for HCFS */ +# define OHCI_USB_RESET (0 << 6) +# define OHCI_USB_RESUME (1 << 6) +# define OHCI_USB_OPER (2 << 6) +# define OHCI_USB_SUSPEND (3 << 6) + +/* + * HcCommandStatus (cmdstatus) register masks + */ +#define OHCI_HCR (1 << 0) /* host controller reset */ +#define OHCI_CLF (1 << 1) /* control list filled */ +#define OHCI_BLF (1 << 2) /* bulk list filled */ +#define OHCI_OCR (1 << 3) /* ownership change request */ +#define OHCI_SOC (3 << 16) /* scheduling overrun count */ + +/* + * masks used with interrupt registers: + * HcInterruptStatus (intrstatus) + * HcInterruptEnable (intrenable) + * HcInterruptDisable (intrdisable) + */ +#define OHCI_INTR_SO (1 << 0) /* scheduling overrun */ +#define OHCI_INTR_WDH (1 << 1) /* writeback of done_head */ +#define OHCI_INTR_SF (1 << 2) /* start frame */ +#define OHCI_INTR_RD (1 << 3) /* resume detect */ +#define OHCI_INTR_UE (1 << 4) /* unrecoverable error */ +#define OHCI_INTR_FNO (1 << 5) /* frame number overflow */ +#define OHCI_INTR_RHSC (1 << 6) /* root hub status change */ +#define OHCI_INTR_OC (1 << 30) /* ownership change */ +#define OHCI_INTR_MIE (1 << 31) /* master interrupt enable */ + + +/* OHCI ROOT HUB REGISTER MASKS */ + +/* roothub.portstatus [i] bits */ +#define RH_PS_CCS 0x00000001 /* current connect status */ +#define RH_PS_PES 0x00000002 /* port enable status*/ +#define RH_PS_PSS 0x00000004 /* port suspend status */ +#define RH_PS_POCI 0x00000008 /* port over current indicator */ +#define RH_PS_PRS 0x00000010 /* port reset status */ +#define RH_PS_PPS 0x00000100 /* port power status */ +#define RH_PS_LSDA 0x00000200 /* low speed device attached */ +#define RH_PS_CSC 0x00010000 /* connect status change */ +#define RH_PS_PESC 0x00020000 /* port enable status change */ +#define RH_PS_PSSC 0x00040000 /* port suspend status change */ +#define RH_PS_OCIC 0x00080000 /* over current indicator change */ +#define RH_PS_PRSC 0x00100000 /* port reset status change */ + +/* roothub.status bits */ +#define RH_HS_LPS 0x00000001 /* local power status */ +#define RH_HS_OCI 0x00000002 /* over current indicator */ +#define RH_HS_DRWE 0x00008000 /* device remote wakeup enable */ +#define RH_HS_LPSC 0x00010000 /* local power status change */ +#define RH_HS_OCIC 0x00020000 /* over current indicator change */ +#define RH_HS_CRWE 0x80000000 /* clear remote wakeup enable */ + +/* roothub.b masks */ +#define RH_B_DR 0x0000ffff /* device removable flags */ +#define RH_B_PPCM 0xffff0000 /* port power control mask */ + +/* roothub.a masks */ +#define RH_A_NDP (0xff << 0) /* number of downstream ports */ +#define RH_A_PSM (1 << 8) /* power switching mode */ +#define RH_A_NPS (1 << 9) /* no power switching */ +#define RH_A_DT (1 << 10) /* device type (mbz) */ +#define RH_A_OCPM (1 << 11) /* over current protection mode */ +#define RH_A_NOCP (1 << 12) /* no over current protection */ +#define RH_A_POTPGT (0xff << 24) /* power on to power good time */ + +/* + * This is the structure of the OHCI controller's memory mapped I/O region. + * You must use readl() and writel() (in <asm/io.h>) to access these fields!! + * Layout is in section 7 (and appendix B) of the spec. + */ +struct _OHCI_REGS +{ + /* control and status registers (section 7.1) */ + ULONG revision; + ULONG control; + ULONG cmdstatus; + ULONG intrstatus; + ULONG intrenable; + ULONG intrdisable; + + /* memory pointers (section 7.2) */ + ULONG hcca; + ULONG ed_periodcurrent; + ULONG ed_controlhead; + ULONG ed_controlcurrent; + ULONG ed_bulkhead; + ULONG ed_bulkcurrent; + ULONG donehead; + + /* frame counters (section 7.3) */ + ULONG fminterval; + ULONG fmremaining; + ULONG fmnumber; + ULONG periodicstart; + ULONG lsthresh; + + /* Root hub ports (section 7.4) */ + struct ohci_roothub_regs { + ULONG a; + ULONG b; + ULONG status; +#define MAX_ROOT_PORTS 15 /* maximum OHCI root hub ports (RH_A_NDP) */ + ULONG portstatus [MAX_ROOT_PORTS]; + } roothub; + + /* and optional "legacy support" registers (appendix B) at 0x0100 */ +} OHCI_REGS, *POHCI_REGS; typedef struct _OHCI_DEV { @@ -58,4 +194,5 @@ } OHCI_DEVICE_EXTENSION, *POHCI_DEVICE_EXTENSION; + #endif /* __OHCI_H__ */
17 years, 1 month
1
0
0
0
[fireball] 30594: - Fix build.
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 16:47:45 2007 New Revision: 30594 URL:
http://svn.reactos.org/svn/reactos?rev=30594&view=rev
Log: - Fix build. Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c Tue Nov 20 16:47:45 2007 @@ -3417,7 +3417,7 @@ // VOID ehci_init_int8_qh(PEHCI_QH_CONTENT qh); -static BOOLEAN NTAPI +BOOLEAN NTAPI ehci_cal_cpu_freq(PVOID context) { usb_cal_cpu_freq();
17 years, 1 month
1
0
0
0
[fireball] 30593: - Implement more OHCI helper routines.
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 15:58:23 2007 New Revision: 30593 URL:
http://svn.reactos.org/svn/reactos?rev=30593&view=rev
Log: - Implement more OHCI helper routines. Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.c Tue Nov 20 15:58:23 2007 @@ -21,6 +21,7 @@ */ #include "usbdriver.h" +#include "ehci.h" #include "ohci.h" PDEVICE_OBJECT ohci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, @@ -29,14 +30,20 @@ //static VOID ohci_stop(PEHCI_DEV ehci); PDEVICE_OBJECT ohci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER dev_mgr); -//PDEVICE_OBJECT ohci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr); +PDEVICE_OBJECT ohci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr); //BOOLEAN ohci_delete_device(PDEVICE_OBJECT pdev); //VOID ohci_get_capabilities(PEHCI_DEV ehci, PBYTE base); //BOOLEAN NTAPI ohci_isr(PKINTERRUPT interrupt, PVOID context); //BOOLEAN ohci_start(PHCD hcd); +VOID ohci_init_hcd_interface(POHCI_DEV ohci); + +// shared with EHCI +NTSTATUS ehci_dispatch_irp(IN PDEVICE_OBJECT DeviceObject, IN PIRP irp); +VOID ehci_set_dev_mgr(PHCD hcd, PUSB_DEV_MANAGER dev_mgr); +VOID ehci_set_id(PHCD hcd, UCHAR id); +BOOLEAN NTAPI ehci_cal_cpu_freq(PVOID context); extern USB_DEV_MANAGER g_dev_mgr; - PDEVICE_OBJECT ohci_probe(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, PUSB_DEV_MANAGER dev_mgr) @@ -91,7 +98,7 @@ if (pdev_ext) { // acquire higher irql to eliminate pre-empty - //KeSynchronizeExecution(pdev_ext->ehci_int, ehci_cal_cpu_freq, NULL); + KeSynchronizeExecution(pdev_ext->ohci_int, ehci_cal_cpu_freq, NULL); } } return NULL; @@ -100,25 +107,33 @@ PDEVICE_OBJECT ohci_alloc(PDRIVER_OBJECT drvr_obj, PUNICODE_STRING reg_path, ULONG bus_addr, PUSB_DEV_MANAGER dev_mgr) { - //LONG frd_num, prd_num; + LONG frd_num, prd_num; PDEVICE_OBJECT pdev = NULL; - //POHCI_DEVICE_EXTENSION pdev_ext; - //ULONG vector, addr_space; + POHCI_DEVICE_EXTENSION pdev_ext; + ULONG addr_space; + //ULONG vector; LONG bus; //KIRQL irql; //KAFFINITY affinity; DEVICE_DESCRIPTION dev_desc; - //CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; + CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; - //NTSTATUS status; - + NTSTATUS status; + + pdev = ohci_create_device(drvr_obj, dev_mgr); + + if (pdev == NULL) + return NULL; + + pdev_ext = pdev->DeviceExtension; + + pdev_ext->pci_addr = bus_addr; bus = (bus_addr >> 8); slot_num.u.AsULONG = 0; slot_num.u.bits.DeviceNumber = ((bus_addr & 0xff) >> 3); slot_num.u.bits.FunctionNumber = (bus_addr & 0x07); - //now create adapter object RtlZeroMemory(&dev_desc, sizeof(dev_desc)); @@ -135,7 +150,7 @@ ohci_alloc(): bus=0x%x, bus_addr=0x%x \n \ ohci_alloc(): slot_num=0x%x \n \ ", (DWORD) reg_path, (DWORD) bus, (DWORD) bus_addr, (DWORD) slot_num.u.AsULONG); -#if 0 + //let's allocate resources for this device DbgPrint("ohci_alloc(): about to assign slot res\n"); if ((status = HalAssignSlotResources(reg_path, NULL, //no class name yet @@ -144,9 +159,11 @@ bus, slot_num.u.AsULONG, &pdev_ext->res_list)) != STATUS_SUCCESS) { DbgPrint("ohci_alloc(): error assign slot res, 0x%x\n", status); +#if 0 release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; ohci_delete_device(pdev); +#endif return NULL; } @@ -176,44 +193,48 @@ //for port, translate them to system address addr_space = 0; if (HalTranslateBusAddress(PCIBus, bus, pdev_ext->res_port.Start, &addr_space, //io space - &pdev_ext->ehci->ehci_reg_base) != (BOOLEAN) TRUE) - { - DbgPrint("ehci_alloc(): error, can not translate bus address\n"); + &pdev_ext->ohci->ohci_reg_base) != (BOOLEAN) TRUE) + { + DbgPrint("ohci_alloc(): error, can not translate bus address\n"); +#if 0 release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; ehci_delete_device(pdev); - return NULL; - } - - DbgPrint("ehci_alloc(): address space=0x%x\n, reg_base=0x%x\n", - addr_space, pdev_ext->ehci->ehci_reg_base.u.LowPart); +#endif + return NULL; + } + + DbgPrint("ohci_alloc(): address space=0x%x\n, reg_base=0x%x\n", + addr_space, pdev_ext->ohci->ohci_reg_base.u.LowPart); if (addr_space == 0) { //port has been mapped to memory space - pdev_ext->ehci->port_mapped = TRUE; - pdev_ext->ehci->port_base = (PBYTE) MmMapIoSpace(pdev_ext->ehci->ehci_reg_base, + pdev_ext->ohci->port_mapped = TRUE; + pdev_ext->ohci->port_base = (PBYTE) MmMapIoSpace(pdev_ext->ohci->ohci_reg_base, pdev_ext->res_port.Length, FALSE); //fatal error can not map the registers - if (pdev_ext->ehci->port_base == NULL) + if (pdev_ext->ohci->port_base == NULL) { +#if 0 release_adapter(pdev_ext->padapter); pdev_ext->padapter = NULL; ehci_delete_device(pdev); +#endif return NULL; } } else { //io space - pdev_ext->ehci->port_mapped = FALSE; - pdev_ext->ehci->port_base = (PBYTE) pdev_ext->ehci->ehci_reg_base.LowPart; - } - - //before we connect the interrupt, we have to init ehci - pdev_ext->ehci->pdev_ext = pdev_ext; - + pdev_ext->ohci->port_mapped = FALSE; + pdev_ext->ohci->port_base = (PBYTE) pdev_ext->ohci->ohci_reg_base.LowPart; + } + + //before we connect the interrupt, we have to init ohci + pdev_ext->ohci->pdev_ext = pdev_ext; +#if 0 //init ehci_caps // i = ( ( PEHCI_HCS_CONTENT )( &pdev_ext->ehci->ehci_caps.hcs_params ) )->length; @@ -266,6 +287,99 @@ PDEVICE_OBJECT ohci_create_device(PDRIVER_OBJECT drvr_obj, PUSB_DEV_MANAGER dev_mgr) { - return NULL; + NTSTATUS status; + PDEVICE_OBJECT pdev; + POHCI_DEVICE_EXTENSION pdev_ext; + + UNICODE_STRING dev_name; + UNICODE_STRING symb_name; + + STRING string, another_string; + CHAR str_dev_name[64], str_symb_name[64]; + UCHAR hcd_id; + + if (drvr_obj == NULL) + return NULL; + + //note: hcd count wont increment till the hcd is registered in dev_mgr + sprintf(str_dev_name, "%s%d", OHCI_DEVICE_NAME, dev_mgr->hcd_count); + sprintf(str_symb_name, "%s%d", OHCI_DOS_DEVICE_NAME, dev_mgr->hcd_count); + + RtlInitString(&string, str_dev_name); + RtlAnsiStringToUnicodeString(&dev_name, &string, TRUE); + + pdev = NULL; + status = IoCreateDevice(drvr_obj, + sizeof(OHCI_DEVICE_EXTENSION) + sizeof(OHCI_DEV), + &dev_name, FILE_OHCI_DEV_TYPE, 0, FALSE, &pdev); + + if (status != STATUS_SUCCESS || pdev == NULL) + { + RtlFreeUnicodeString(&dev_name); + ehci_dbg_print(DBGLVL_MAXIMUM, ("ohci_create_device(): error create device 0x%x\n", status)); + return NULL; + } + + pdev_ext = pdev->DeviceExtension; + RtlZeroMemory(pdev_ext, sizeof(OHCI_DEVICE_EXTENSION) + sizeof(OHCI_DEV)); + + pdev_ext->dev_ext_hdr.type = NTDEV_TYPE_HCD; + pdev_ext->dev_ext_hdr.dispatch = ehci_dispatch_irp; + pdev_ext->dev_ext_hdr.start_io = NULL; //we do not support startio + pdev_ext->dev_ext_hdr.dev_mgr = dev_mgr; + + pdev_ext->pdev_obj = pdev; + pdev_ext->pdrvr_obj = drvr_obj; + + pdev_ext->ohci = (POHCI_DEV) & (pdev_ext[1]); + + RtlInitString(&another_string, str_symb_name); + RtlAnsiStringToUnicodeString(&symb_name, &another_string, TRUE); + //RtlInitUnicodeString( &symb_name, DOS_DEVICE_NAME ); + + IoCreateSymbolicLink(&symb_name, &dev_name); + + ehci_dbg_print(DBGLVL_MAXIMUM, + ("ohci_create_device(): dev=0x%x\n, pdev_ext= 0x%x, ehci=0x%x, dev_mgr=0x%x\n", pdev, + pdev_ext, pdev_ext->ohci, dev_mgr)); + + RtlFreeUnicodeString(&dev_name); + RtlFreeUnicodeString(&symb_name); + + //register with dev_mgr though it is not initilized + ohci_init_hcd_interface(pdev_ext->ohci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ohci->hcd_interf); + + pdev_ext->ohci->hcd_interf.hcd_set_id(&pdev_ext->ohci->hcd_interf, hcd_id); + pdev_ext->ohci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ohci->hcd_interf, dev_mgr); + + return pdev; } +VOID +ohci_init_hcd_interface(POHCI_DEV ohci) +{ + ohci->hcd_interf.hcd_set_dev_mgr = ehci_set_dev_mgr; +#if 0 + ohci->hcd_interf.hcd_get_dev_mgr = ehci_get_dev_mgr; + ohci->hcd_interf.hcd_get_type = ehci_get_type; +#endif + ohci->hcd_interf.hcd_set_id = ehci_set_id; +#if 0 + ohci->hcd_interf.hcd_get_id = ehci_get_id; + ohci->hcd_interf.hcd_alloc_addr = ehci_alloc_addr; + ohci->hcd_interf.hcd_free_addr = ehci_free_addr; + ohci->hcd_interf.hcd_submit_urb = ehci_submit_urb2; + ohci->hcd_interf.hcd_generic_urb_completion = ehci_generic_urb_completion; + ohci->hcd_interf.hcd_get_root_hub = ehci_get_root_hub; + ohci->hcd_interf.hcd_set_root_hub = ehci_set_root_hub; + ohci->hcd_interf.hcd_remove_device = ehci_remove_device2; + ohci->hcd_interf.hcd_rh_reset_port = ehci_rh_reset_port; + ohci->hcd_interf.hcd_release = ehci_hcd_release; + ohci->hcd_interf.hcd_cancel_urb = ehci_cancel_urb2; + ohci->hcd_interf.hcd_start = ehci_start; + ohci->hcd_interf.hcd_dispatch = ehci_hcd_dispatch; +#endif + ohci->hcd_interf.flags = HCD_TYPE_OHCI; //hcd types | hcd id +} + Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbd…
============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ohci.h Tue Nov 20 15:58:23 2007 @@ -18,9 +18,20 @@ #ifndef __OHCI_H__ #define __OHCI_H__ +#define OHCI_DEVICE_NAME "\\Device\\OHCI" +#define OHCI_DOS_DEVICE_NAME "\\DosDevices\\OHCI" + typedef struct _OHCI_DEV { HCD hcd_interf; + + PHYSICAL_ADDRESS ohci_reg_base; // io space + BOOLEAN port_mapped; + PBYTE port_base; // note: added by ehci_caps.length, operational regs base addr, not the actural base + + KTIMER reset_timer; //used to reset the host controller + struct _OHCI_DEVICE_EXTENSION *pdev_ext; + PUSB_DEV root_hub; //root hub } OHCI_DEV, *POHCI_DEV; typedef struct _OHCI_DEVICE_EXTENSION @@ -30,11 +41,20 @@ PDRIVER_OBJECT pdrvr_obj; POHCI_DEV ohci; + //device resources + PADAPTER_OBJECT padapter; + ULONG map_regs; + PCM_RESOURCE_LIST res_list; ULONG pci_addr; // bus number | slot number | funciton number UHCI_INTERRUPT res_interrupt; + union + { + UHCI_PORT res_port; + EHCI_MEMORY res_memory; + }; - PKINTERRUPT ohci_int; - KDPC ohci_dpc; + PKINTERRUPT ohci_int; + KDPC ohci_dpc; } OHCI_DEVICE_EXTENSION, *POHCI_DEVICE_EXTENSION;
17 years, 1 month
1
0
0
0
[fireball] 30592: - Don't create a possibility for CriticalRegion leakage (spotted by PREfast).
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 14:53:15 2007 New Revision: 30592 URL:
http://svn.reactos.org/svn/reactos?rev=30592&view=rev
Log: - Don't create a possibility for CriticalRegion leakage (spotted by PREfast). Modified: trunk/reactos/drivers/filesystems/vfat/misc.c Modified: trunk/reactos/drivers/filesystems/vfat/misc.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/vfat/m…
============================================================================== --- trunk/reactos/drivers/filesystems/vfat/misc.c (original) +++ trunk/reactos/drivers/filesystems/vfat/misc.c Tue Nov 20 14:53:15 2007 @@ -142,6 +142,7 @@ { NTSTATUS Status; PVFAT_IRP_CONTEXT IrpContext; + KIRQL Irql; DPRINT ("VfatBuildRequest (DeviceObject %x, Irp %x)\n", DeviceObject, Irp); @@ -156,17 +157,18 @@ } else { - if (KeGetCurrentIrql() <= PASSIVE_LEVEL) + Irql = KeGetCurrentIrql(); + if (Irql <= PASSIVE_LEVEL) { FsRtlEnterFileSystem(); } else { - DPRINT1("Vfat is entered at irql = %d\n", KeGetCurrentIrql()); + DPRINT1("Vfat is entered at irql = %d\n", Irql); } Status = VfatDispatchRequest (IrpContext); - if (KeGetCurrentIrql() <= PASSIVE_LEVEL) + if (Irql <= PASSIVE_LEVEL) { FsRtlExitFileSystem(); }
17 years, 1 month
1
0
0
0
[arty] 30591: We need to separate the idea of 'fully initialized' from 'ldr data structures are present' so we can deal with early thread creation. This fixes cygwin.
by arty@svn.reactos.org
Author: arty Date: Tue Nov 20 13:22:52 2007 New Revision: 30591 URL:
http://svn.reactos.org/svn/reactos?rev=30591&view=rev
Log: We need to separate the idea of 'fully initialized' from 'ldr data structures are present' so we can deal with early thread creation. This fixes cygwin. Modified: trunk/reactos/dll/ntdll/ldr/startup.c Modified: trunk/reactos/dll/ntdll/ldr/startup.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/ntdll/ldr/startup.c?re…
============================================================================== --- trunk/reactos/dll/ntdll/ldr/startup.c (original) +++ trunk/reactos/dll/ntdll/ldr/startup.c Tue Nov 20 13:22:52 2007 @@ -249,7 +249,7 @@ PEPFUNC EntryPoint; PIMAGE_DOS_HEADER PEDosHeader; PVOID ImageBase; - PPEB Peb; + PPEB Peb = NtCurrentPeb(); PLDR_DATA_TABLE_ENTRY NtModule; // ntdll NLSTABLEINFO NlsTable; WCHAR FullNtDllPath[MAX_PATH]; @@ -257,12 +257,12 @@ NTSTATUS Status; DPRINT("LdrpInit()\n"); - if (NtCurrentPeb()->Ldr == NULL || NtCurrentPeb()->Ldr->Initialized == FALSE) + DPRINT("Peb %p\n", Peb); + ImageBase = Peb->ImageBaseAddress; + DPRINT("ImageBase %p\n", ImageBase); + + if (NtCurrentPeb()->Ldr == NULL) { - Peb = NtCurrentPeb(); - DPRINT("Peb %p\n", Peb); - ImageBase = Peb->ImageBaseAddress; - DPRINT("ImageBase %p\n", ImageBase); if (ImageBase <= (PVOID)0x1000) { DPRINT("ImageBase is null\n"); @@ -419,7 +419,10 @@ LdrpLoadUserModuleSymbols(NtModule); #endif /* DBG || KDBG */ - + } + + if (NtCurrentPeb()->Ldr->Initialized == FALSE) + { /* add entry for executable (becomes first list entry) */ ExeModule = (PLDR_DATA_TABLE_ENTRY)RtlAllocateHeap (Peb->ProcessHeap, 0,
17 years, 1 month
1
0
0
0
[fireball] 30590: - Load symbols for NTOSKRNL and HAL as 1st and 2nd entries in LoadOrderList in LPB. - Remove now unused symbol-loading function, silence an error message in rossym/frommem.c, since it's a normal situation now (if it's not in memory, then it's on disk and needs to be loaded).
by fireball@svn.reactos.org
Author: fireball Date: Tue Nov 20 13:17:34 2007 New Revision: 30590 URL:
http://svn.reactos.org/svn/reactos?rev=30590&view=rev
Log: - Load symbols for NTOSKRNL and HAL as 1st and 2nd entries in LoadOrderList in LPB. - Remove now unused symbol-loading function, silence an error message in rossym/frommem.c, since it's a normal situation now (if it's not in memory, then it's on disk and needs to be loaded). Modified: trunk/reactos/lib/rossym/frommem.c trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c Modified: trunk/reactos/lib/rossym/frommem.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rossym/frommem.c?rev=3…
============================================================================== --- trunk/reactos/lib/rossym/frommem.c (original) +++ trunk/reactos/lib/rossym/frommem.c Tue Nov 20 13:17:34 2007 @@ -72,7 +72,7 @@ if (ImageSize < SectionHeader->PointerToRawData + SectionHeader->SizeOfRawData || SectionHeader->SizeOfRawData < sizeof(ROSSYM_HEADER)) { - DPRINT1("Invalid %s section\n", ROSSYM_SECTION_NAME); + DPRINT("Invalid %s section\n", ROSSYM_SECTION_NAME); return FALSE; } Modified: trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/kdbg/kdb_symbols.…
============================================================================== --- trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c (original) +++ trunk/reactos/ntoskrnl/kdbg/kdb_symbols.c Tue Nov 20 13:17:34 2007 @@ -651,122 +651,6 @@ } - -/*! \brief Called when a symbol file is loaded by the loader? - * - * Tries to find a driver (.sys) or executable (.exe) with the same base name - * as the symbol file and sets the drivers/exes symbol info to the loaded - * module. - * Used to load ntoskrnl and hal symbols before the SystemRoot is available to us. - * - * \param FileName Filename for which the symbols are loaded. - */ -VOID -KdbSymProcessBootSymbols(IN PANSI_STRING AnsiFileName, - IN BOOLEAN FullName, - IN BOOLEAN LoadFromFile) -{ - BOOLEAN Found = FALSE; - PLIST_ENTRY ListHead, NextEntry; - PLDR_DATA_TABLE_ENTRY LdrEntry = NULL; - WCHAR Buffer[MAX_PATH]; - UNICODE_STRING ModuleName; - NTSTATUS Status; - - /* Convert file name to unicode */ - ModuleName.MaximumLength = (MAX_PATH-1)*sizeof(WCHAR); - ModuleName.Length = 0; - ModuleName.Buffer = Buffer; - - Status = RtlAnsiStringToUnicodeString(&ModuleName, AnsiFileName, FALSE); - if (!NT_SUCCESS(Status)) - { - DPRINT1("Failed to convert Ansi to Unicode with Status=0x%08X, Length=%d\n", - Status, ModuleName.Length); - return; - } - - DPRINT("KdbSymProcessBootSymbols(%wZ)\n", &ModuleName); - - /* We use PsLoadedModuleList here, otherwise (in case of - using KeLoaderBlock) all our data will be just lost */ - ListHead = &PsLoadedModuleList; - - /* Found module we are interested in */ - NextEntry = ListHead->Flink; - while (ListHead != NextEntry) - { - /* Get the entry */ - LdrEntry = CONTAINING_RECORD(NextEntry, - LDR_DATA_TABLE_ENTRY, - InLoadOrderLinks); - - if (FullName) - { - if (RtlEqualUnicodeString(&ModuleName, &LdrEntry->FullDllName, TRUE)) - { - Found = TRUE; - break; - } - } - else - { - if (RtlEqualUnicodeString(&ModuleName, &LdrEntry->BaseDllName, TRUE)) - { - Found = TRUE; - break; - } - } - - /* Go to the next one */ - NextEntry = NextEntry->Flink; - } - - /* Exit if we didn't find the module requested */ - if (!Found) - return; - - DPRINT("Found LdrEntry=%p\n", LdrEntry); - if (!LoadSymbols) - { - LdrEntry->PatchInformation = NULL; - return; - } - - /* Remove symbol info if it already exists */ - if (LdrEntry->PatchInformation != NULL) - { - KdbpSymRemoveCachedFile(LdrEntry->PatchInformation); - } - - if (LoadFromFile) - { - /* Load symbol info from file */ - KdbpSymLoadModuleSymbols(&LdrEntry->FullDllName, - (PROSSYM_INFO*)&LdrEntry->PatchInformation); - } - else - { - /* Load new symbol information */ - if (! RosSymCreateFromMem(LdrEntry->DllBase, - LdrEntry->SizeOfImage, - (PROSSYM_INFO*)&LdrEntry->PatchInformation)) - { - /* Error loading symbol info, exit */ - return; - } - - /* Add file to cache */ - KdbpSymAddCachedFile(&ModuleName, LdrEntry->PatchInformation); - } - - DPRINT("Installed symbols: %wZ@%08x-%08x %p\n", - &ModuleName, - LdrEntry->DllBase, - LdrEntry->SizeOfImage + (ULONG)LdrEntry->DllBase, - LdrEntry->PatchInformation); -} - VOID NTAPI KdbDebugPrint(PCH Message, ULONG Length) @@ -786,9 +670,11 @@ ULONG BootPhase) { PCHAR p1, p2; - int Found; - char YesNo; - ANSI_STRING FileName; + SHORT Found; + CHAR YesNo; + LIST_ENTRY *ModuleEntry; + PLDR_DATA_TABLE_ENTRY DataTableEntry; + KD_SYMBOLS_INFO SymbolsInfo; DPRINT("KdbSymInit() BootPhase=%d\n", BootPhase); @@ -860,13 +746,29 @@ } else if (BootPhase == 1) { - /* Load symbols for NTOSKRNL.EXE and HAL.DLL*/ - /* FIXME: Load as 1st and 2nd entries of InLoadOrderList instead - of hardcoding them here! */ - RtlInitAnsiString(&FileName, "\\SystemRoot\\System32\\NTOSKRNL.EXE"); - KdbSymProcessBootSymbols(&FileName, TRUE, FALSE); - RtlInitAnsiString(&FileName, "\\SystemRoot\\System32\\HAL.DLL"); - KdbSymProcessBootSymbols(&FileName, TRUE, FALSE); + /* Load symbols for NTOSKRNL.EXE */ + ModuleEntry = &KeLoaderBlock->LoadOrderListHead; + DataTableEntry = CONTAINING_RECORD(ModuleEntry, + LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); + + SymbolsInfo.BaseOfDll = DataTableEntry->DllBase; + SymbolsInfo.CheckSum = DataTableEntry->CheckSum; + SymbolsInfo.ProcessId = 0; + SymbolsInfo.SizeOfImage = DataTableEntry->SizeOfImage; + + KdbSymProcessSymbols(NULL, &SymbolsInfo); + + /* and HAL.DLL */ + ModuleEntry = ModuleEntry->Flink; + DataTableEntry = CONTAINING_RECORD(ModuleEntry, + LDR_DATA_TABLE_ENTRY, InLoadOrderLinks); + + SymbolsInfo.BaseOfDll = DataTableEntry->DllBase; + SymbolsInfo.CheckSum = DataTableEntry->CheckSum; + SymbolsInfo.ProcessId = 0; + SymbolsInfo.SizeOfImage = DataTableEntry->SizeOfImage; + + KdbSymProcessSymbols(NULL, &SymbolsInfo); } }
17 years, 1 month
1
0
0
0
← Newer
1
...
30
31
32
33
34
35
36
...
89
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Results per page:
10
25
50
100
200