Author: cgutman
Date: Tue Feb  7 01:59:18 2012
New Revision: 55476

URL: http://svn.reactos.org/svn/reactos?rev=55476&view=rev
Log:
[USBOHCI]
- Enable bus master on OHCI controllers if it's not set by default

Modified:
    branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp

Modified: branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp
URL: 
http://svn.reactos.org/svn/reactos/branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp?rev=55476&r1=55475&r2=55476&view=diff
==============================================================================
--- branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] 
(original)
+++ branches/usb-bringup-trunk/drivers/usb/usbohci/hardware.cpp [iso-8859-1] 
Tue Feb  7 01:59:18 2012
@@ -221,13 +221,40 @@
         return STATUS_SUCCESS;
     }
 
-    if (!(PciConfig.Command & PCI_ENABLE_BUS_MASTER))
-    {
-        DPRINT1("PCI Configuration shows this as a non Bus Mastering 
device!\n");
-    }
-
     m_VendorID = PciConfig.VendorID;
     m_DeviceID = PciConfig.DeviceID;
+
+    if (PciConfig.Command & PCI_ENABLE_BUS_MASTER)
+    {
+        //
+        // master is enabled
+        //
+        return STATUS_SUCCESS;
+    }
+
+    DPRINT1("PCI Configuration shows this as a non Bus Mastering device! 
Enabling...\n");
+
+    PciConfig.Command |= PCI_ENABLE_BUS_MASTER;
+    BusInterface.SetBusData(BusInterface.Context, PCI_WHICHSPACE_CONFIG, 
&PciConfig, 0, PCI_COMMON_HDR_LENGTH);
+
+    BytesRead = (*BusInterface.GetBusData)(BusInterface.Context,
+                                           PCI_WHICHSPACE_CONFIG,
+                                           &PciConfig,
+                                           0,
+                                           PCI_COMMON_HDR_LENGTH);
+
+    if (BytesRead != PCI_COMMON_HDR_LENGTH)
+    {
+        DPRINT1("Failed to get pci config information!\n");
+        ASSERT(FALSE);
+        return STATUS_SUCCESS;
+    }
+
+    if (!(PciConfig.Command & PCI_ENABLE_BUS_MASTER))
+    {
+        DPRINT1("Failed to enable master\n");
+        return STATUS_UNSUCCESSFUL;
+    }
 
     return STATUS_SUCCESS;
 }


Reply via email to