From ec95123297f330c2463321f0dc60f7c74be4571b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Tue, 7 Feb 2012 01:59:18 +0000 Subject: [PATCH] [USBOHCI] - Enable bus master on OHCI controllers if it's not set by default svn path=/branches/usb-bringup-trunk/; revision=55476 --- drivers/usb/usbohci/hardware.cpp | 37 +++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/drivers/usb/usbohci/hardware.cpp b/drivers/usb/usbohci/hardware.cpp index 5dc1981f75f..bda33d0b519 100644 --- a/drivers/usb/usbohci/hardware.cpp +++ b/drivers/usb/usbohci/hardware.cpp @@ -221,14 +221,41 @@ CUSBHardwareDevice::Initialize( 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; }