[ros-diffs] [janderwald] 55110: [USBEHCI] - Use the same lock in the IUSBQueue as in the IDMAMemoryManager - add debug traces (default off)

janderwald at svn.reactos.org janderwald at svn.reactos.org
Mon Jan 23 15:49:44 UTC 2012


Author: janderwald
Date: Mon Jan 23 15:49:43 2012
New Revision: 55110

URL: http://svn.reactos.org/svn/reactos?rev=55110&view=rev
Log:
[USBEHCI]
- Use the same lock in the IUSBQueue as in the IDMAMemoryManager
- add debug traces (default off)

Modified:
    branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp
    branches/usb-bringup-trunk/drivers/usb/usbehci_new/hub_controller.cpp
    branches/usb-bringup-trunk/drivers/usb/usbehci_new/memory_manager.cpp
    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/hardware.cpp
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbehci_new/hardware.cpp?rev=55110&r1=55109&r2=55110&view=diff
==============================================================================
--- 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] Mon Jan 23 15:49:43 2012
@@ -438,7 +438,7 @@
     //
     // Initialize the UsbQueue now that we have an AdapterObject.
     //
-    Status = m_UsbQueue->Initialize(PUSBHARDWAREDEVICE(this), m_Adapter, m_MemoryManager, NULL);
+    Status = m_UsbQueue->Initialize(PUSBHARDWAREDEVICE(this), m_Adapter, m_MemoryManager, &m_Lock);
     if (!NT_SUCCESS(Status))
     {
         DPRINT1("Failed to Initialize the UsbQueue\n");
@@ -934,7 +934,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // return old irql
@@ -947,6 +949,7 @@
 CUSBHardwareDevice::ReleaseDeviceLock(
     KIRQL OldLevel)
 {
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 }
 

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/usbehci_new/hub_controller.cpp?rev=55110&r1=55109&r2=55110&view=diff
==============================================================================
--- 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] Mon Jan 23 15:49:43 2012
@@ -1861,7 +1861,9 @@
     //
     // acquire device lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // find address
@@ -1883,6 +1885,7 @@
     //
     // release spin lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 
     //
@@ -1900,7 +1903,9 @@
     //
     // acquire device lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // sanity check
@@ -1920,6 +1925,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 }
 //-----------------------------------------------------------------------------------------
@@ -1935,7 +1941,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // point to first entry
@@ -1983,6 +1991,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 
     //
@@ -2002,7 +2011,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // point to first entry
@@ -2040,6 +2051,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 
     //
@@ -2077,7 +2089,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // insert entry
@@ -2087,6 +2101,7 @@
     //
     // release spin lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 
     //
@@ -2106,7 +2121,9 @@
     //
     // acquire hub controller lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // now set the callback routine and context of the hub
@@ -2114,10 +2131,11 @@
     m_HubCallbackContext = CallbackContext;
     m_HubCallbackRoutine = CallbackRoutine;
 
-   //
-   // release hub controller lock
-   //
-   KeReleaseSpinLock(&m_Lock, OldLevel);
+    //
+    // release hub controller lock
+    //
+    DPRINT(__FUNCTION__ "release\n");
+    KeReleaseSpinLock(&m_Lock, OldLevel);
 }
 
 //=================================================================================================

Modified: branches/usb-bringup-trunk/drivers/usb/usbehci_new/memory_manager.cpp
URL: http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbehci_new/memory_manager.cpp?rev=55110&r1=55109&r2=55110&view=diff
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbehci_new/memory_manager.cpp [iso-8859-1] (original)
+++ branches/usb-bringup-trunk/drivers/usb/usbehci_new/memory_manager.cpp [iso-8859-1] Mon Jan 23 15:49:43 2012
@@ -157,7 +157,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // helper variable
@@ -235,6 +237,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(m_Lock, OldLevel);
 
     //
@@ -304,7 +307,9 @@
     //
     // acquire lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // release buffer
@@ -314,6 +319,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(m_Lock, OldLevel);
 
     //

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/usbehci_new/usb_device.cpp?rev=55110&r1=55109&r2=55110&view=diff
==============================================================================
--- 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] Mon Jan 23 15:49:43 2012
@@ -519,7 +519,9 @@
     //
     // acquire device lock
     //
+    DPRINT(__FUNCTION__ " acquire\n");
     KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // commit urb
@@ -529,6 +531,7 @@
     //
     // release lock
     //
+    DPRINT(__FUNCTION__ "release\n");
     KeReleaseSpinLock(&m_Lock, OldLevel);
 
     return Status;

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/usbehci_new/usb_queue.cpp?rev=55110&r1=55109&r2=55110&view=diff
==============================================================================
--- 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] Mon Jan 23 15:49:43 2012
@@ -33,7 +33,7 @@
         return m_Ref;
     }
 
-    virtual NTSTATUS Initialize(IN PUSBHARDWAREDEVICE Hardware, PDMA_ADAPTER AdapterObject, IN PDMAMEMORYMANAGER MemManager, IN OPTIONAL PKSPIN_LOCK Lock);
+    virtual NTSTATUS Initialize(IN PUSBHARDWAREDEVICE Hardware, PDMA_ADAPTER AdapterObject, IN PDMAMEMORYMANAGER MemManager, IN PKSPIN_LOCK Lock);
     virtual ULONG GetPendingRequestCount();
     virtual NTSTATUS AddUSBRequest(PURB Urb);
     virtual NTSTATUS AddUSBRequest(IUSBRequest * Request);
@@ -48,7 +48,7 @@
 
 protected:
     LONG m_Ref;                                                                         // reference count
-    KSPIN_LOCK m_Lock;                                                                  // list lock
+    PKSPIN_LOCK m_Lock;                                                                  // list lock
     PDMA_ADAPTER m_Adapter;                                                             // dma adapter
     PUSBHARDWAREDEVICE m_Hardware;                                                      // stores hardware object
     PQUEUE_HEAD AsyncListQueueHead;                                                     // async queue head
@@ -114,7 +114,7 @@
     //
     // initialize device lock
     //
-    KeInitializeSpinLock(&m_Lock);
+    m_Lock = Lock;
 
     //
     // Get the AsyncQueueHead
@@ -355,9 +355,13 @@
         //
         // Add it to the pending list
         //
-        KeAcquireSpinLock(&m_Lock, &OldLevel);
+        DPRINT(__FUNCTION__ " acquire\n");
+        KeAcquireSpinLock(m_Lock, &OldLevel);
+        DPRINT(__FUNCTION__ " acquired\n");
+
         LinkQueueHead(AsyncListQueueHead, QueueHead);
-        KeReleaseSpinLock(&m_Lock, OldLevel);
+        DPRINT(__FUNCTION__ "release\n");
+        KeReleaseSpinLock(m_Lock, OldLevel);
     }
 
 
@@ -575,8 +579,6 @@
     PQUEUE_HEAD CurrentQH,
     NTSTATUS Status)
 {
-    KIRQL OldLevel;
-
     //
     // now unlink the queue head
     // FIXME: implement chained queue heads
@@ -608,7 +610,9 @@
     //
     // lock completed async list
     //
-    KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquire\n");
+    KeAcquireSpinLock(m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // walk async list 
@@ -664,7 +668,8 @@
     //
     // release lock
     //
-    KeReleaseSpinLock(&m_Lock, OldLevel);
+    DPRINT(__FUNCTION__ "release\n");
+    KeReleaseSpinLock(m_Lock, OldLevel);
 }
 
 
@@ -767,7 +772,9 @@
             //
             // first acquire request lock
             //
-            KeAcquireSpinLock(&m_Lock, &OldLevel);
+            DPRINT(__FUNCTION__ " acquire\n");
+            KeAcquireSpinLock(m_Lock, &OldLevel);
+            DPRINT(__FUNCTION__ " acquired\n");
 
             //
             // add to pending list
@@ -777,7 +784,8 @@
             //
             // release queue head
             //
-            KeReleaseSpinLock(&m_Lock, OldLevel);
+            DPRINT(__FUNCTION__ "release\n");
+            KeReleaseSpinLock(m_Lock, OldLevel);
 
             //
             // Done for now
@@ -846,7 +854,9 @@
     //
     // first acquire request lock
     //
-    KeAcquireSpinLock(&m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquire\n");
+    KeAcquireSpinLock(m_Lock, &OldLevel);
+    DPRINT(__FUNCTION__ " acquired\n");
 
     //
     // the list should not be empty
@@ -873,7 +883,8 @@
         //
         // release lock
         //
-        KeReleaseSpinLock(&m_Lock, OldLevel);
+        DPRINT(__FUNCTION__ "release\n");
+        KeReleaseSpinLock(m_Lock, OldLevel);
 
         //
         // complete request now
@@ -883,7 +894,10 @@
         //
         // first acquire request lock
         //
-        KeAcquireSpinLock(&m_Lock, &OldLevel);
+        DPRINT(__FUNCTION__ " acquire\n");
+        KeAcquireSpinLock(m_Lock, &OldLevel);
+        DPRINT(__FUNCTION__ " acquired\n");
+
     }
 
     //
@@ -910,7 +924,8 @@
     //
     // release lock
     //
-    KeReleaseSpinLock(&m_Lock, OldLevel);
+    DPRINT(__FUNCTION__ "release\n");
+    KeReleaseSpinLock(m_Lock, OldLevel);
 }
 
 NTSTATUS




More information about the Ros-diffs mailing list