From a4c2608e3489643d4cb2339a65975145b65e72c9 Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sun, 29 Jan 2012 20:34:46 +0000 Subject: [PATCH] [USBEHCI] - Enable device as pci bus master - Fixes hanging of Vmware USB EHCI controller - Revert changes from 55293 from usb_queue - Currently crashes when usbstor wants to receive descriptors svn path=/branches/usb-bringup-trunk/; revision=55294 --- drivers/usb/usbehci_new/hardware.cpp | 38 +++++++++++++++++++++++---- drivers/usb/usbehci_new/usb_queue.cpp | 2 -- drivers/usb/usbehci_new/usbehci.h | 2 +- 3 files changed, 34 insertions(+), 8 deletions(-) diff --git a/drivers/usb/usbehci_new/hardware.cpp b/drivers/usb/usbehci_new/hardware.cpp index c4007dc4d42..ee6a262475f 100644 --- a/drivers/usb/usbehci_new/hardware.cpp +++ b/drivers/usb/usbehci_new/hardware.cpp @@ -226,14 +226,42 @@ 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)) + { + PciConfig.Command |= PCI_ENABLE_BUS_MASTER; + DPRINT1("Failed to enable master\n"); + return STATUS_UNSUCCESSFUL; + } return STATUS_SUCCESS; } diff --git a/drivers/usb/usbehci_new/usb_queue.cpp b/drivers/usb/usbehci_new/usb_queue.cpp index 6b83f7d7402..a8ce84b6ce6 100644 --- a/drivers/usb/usbehci_new/usb_queue.cpp +++ b/drivers/usb/usbehci_new/usb_queue.cpp @@ -368,8 +368,6 @@ CUSBQueue::AddUSBRequest( m_Hardware->GetCommandRegister(&UsbCmd); ASSERT(UsbCmd.AsyncEnable == TRUE); - m_Hardware->SetAsyncListRegister(QueueHead->PhysicalAddr); - } diff --git a/drivers/usb/usbehci_new/usbehci.h b/drivers/usb/usbehci_new/usbehci.h index a4d18965d38..5e4f5abfaba 100644 --- a/drivers/usb/usbehci_new/usbehci.h +++ b/drivers/usb/usbehci_new/usbehci.h @@ -2,7 +2,7 @@ #define USBEHCI_H__ #include -#define NDEBUG +#define YDEBUG #include #include #include