Author: cgutman Date: Sun May 9 13:18:16 2010 New Revision: 47139
URL: http://svn.reactos.org/svn/reactos?rev=47139&view=rev Log: [USBDRIVER] - Register the device with the device manager only after it has been successfully allocated to avoid a crash - A device that failed in xhci_alloc would never get deregistered from the device manager so it would crash when it entered xhci_start with a partially set up device extension - Define release_adapter to HalPutDmaAdapter to fix a DMA adapter leak [HAL] - Export HalPutDmaAdapter
Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c trunk/reactos/hal/hal.pspec
Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdr... ============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/ehci.c [iso-8859-1] Sun May 9 13:18:16 2010 @@ -58,15 +58,7 @@
#define endp_mult_count( endp ) ( ( ( endp->pusb_endp_desc->wMaxPacketSize & 0x1800 ) >> 11 ) + 1 )
-#if 0 -/* WTF?! */ -#define release_adapter( padapTER ) \ -{\ - ( ( padapTER ) ); \ -} -#else -#define release_adapter( padapTER ) (void)(padapTER) -#endif +#define release_adapter( padapTER ) HalPutDmaAdapter(padapTER)
#define get_int_idx( _urb, _idx ) \ {\ @@ -3538,6 +3530,7 @@ CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; + UCHAR hcd_id;
pdev = ehci_create_device(drvr_obj, dev_mgr); @@ -3704,6 +3697,13 @@ return NULL; }
+ //register with dev_mgr + ehci_init_hcd_interface(pdev_ext->ehci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); + + pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); + pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr); + return pdev; }
@@ -3719,7 +3719,6 @@
STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; - UCHAR hcd_id;
if (drvr_obj == NULL) return NULL; @@ -3768,13 +3767,6 @@
RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name); - - //register with dev_mgr though it is not initilized - ehci_init_hcd_interface(pdev_ext->ehci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->ehci->hcd_interf); - - pdev_ext->ehci->hcd_interf.hcd_set_id(&pdev_ext->ehci->hcd_interf, hcd_id); - pdev_ext->ehci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->ehci->hcd_interf, dev_mgr);
return pdev;
Modified: trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/nt4compat/usbdr... ============================================================================== --- trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c [iso-8859-1] (original) +++ trunk/reactos/drivers/usb/nt4compat/usbdriver/uhci.c [iso-8859-1] Sun May 9 13:18:16 2010 @@ -65,15 +65,8 @@ : enDP->pusb_endp_desc->wMaxPacketSize )
-#if 0 -/* WTF?! */ -#define release_adapter( padapTER ) \ -{\ - ( ( padapTER ) ); \ -} -#else -#define release_adapter( padapTER ) (void)(padapTER) -#endif +#define release_adapter( padapTER ) HalPutDmaAdapter(padapTER) +
#define get_int_idx( _urb, _idx ) \ {\ @@ -413,7 +406,6 @@
STRING string, another_string; CHAR str_dev_name[64], str_symb_name[64]; - UCHAR hcd_id;
if (drvr_obj == NULL) return NULL; @@ -463,12 +455,6 @@ RtlFreeUnicodeString(&dev_name); RtlFreeUnicodeString(&symb_name);
- //register with dev_mgr though it is not initilized - uhci_init_hcd_interface(pdev_ext->uhci); - hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); - - pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); - pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr); return pdev; }
@@ -695,6 +681,7 @@ CM_PARTIAL_RESOURCE_DESCRIPTOR *pprd; PCI_SLOT_NUMBER slot_num; NTSTATUS status; + UCHAR hcd_id;
pdev = uhci_create_device(drvr_obj, dev_mgr); @@ -859,6 +846,13 @@ uhci_release(pdev); return NULL; } + + //register with dev_mgr + uhci_init_hcd_interface(pdev_ext->uhci); + hcd_id = dev_mgr_register_hcd(dev_mgr, &pdev_ext->uhci->hcd_interf); + + pdev_ext->uhci->hcd_interf.hcd_set_id(&pdev_ext->uhci->hcd_interf, hcd_id); + pdev_ext->uhci->hcd_interf.hcd_set_dev_mgr(&pdev_ext->uhci->hcd_interf, dev_mgr);
return pdev; }
Modified: trunk/reactos/hal/hal.pspec URL: http://svn.reactos.org/svn/reactos/trunk/reactos/hal/hal.pspec?rev=47139&... ============================================================================== --- trunk/reactos/hal/hal.pspec [iso-8859-1] (original) +++ trunk/reactos/hal/hal.pspec [iso-8859-1] Sun May 9 13:18:16 2010 @@ -51,6 +51,7 @@ @ stdcall HalInitializeProcessor(long ptr) @ stdcall HalMakeBeep(long) @ stdcall HalProcessorIdle() +@ stdcall HalPutDmaAdapter(ptr) @ stdcall HalQueryDisplayParameters(ptr ptr ptr ptr) @ stdcall HalQueryRealTimeClock(ptr) @ stdcall HalReadDmaCounter(ptr)