Author: janderwald
Date: Wed Feb 29 09:15:42 2012
New Revision: 55913
URL:
http://svn.reactos.org/svn/reactos?rev=55913&view=rev
Log:
[USBOHCI]
- Fix regressions introduced by libusb
Modified:
trunk/reactos/drivers/usb/usbohci/hardware.cpp
trunk/reactos/drivers/usb/usbohci/usb_queue.cpp
trunk/reactos/drivers/usb/usbohci/usb_request.cpp
trunk/reactos/drivers/usb/usbohci/usbohci.h
trunk/reactos/lib/drivers/libusb/hcd_controller.cpp
trunk/reactos/lib/drivers/libusb/hub_controller.cpp
trunk/reactos/lib/drivers/libusb/libusb.cpp
trunk/reactos/lib/drivers/libusb/libusb.h
trunk/reactos/lib/drivers/libusb/memory_manager.cpp
trunk/reactos/lib/drivers/libusb/usb_device.cpp
Modified: trunk/reactos/drivers/usb/usbohci/hardware.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/hardwa…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/hardware.cpp [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -32,7 +32,7 @@
NTAPI
StatusChangeWorkItemRoutine(PVOID Context);
-class CUSBHardwareDevice : public IUSBHardwareDevice
+class CUSBHardwareDevice : public IOHCIHardwareDevice
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@@ -125,6 +125,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::Initialize(
PDRIVER_OBJECT DriverObject,
PDEVICE_OBJECT FunctionalDeviceObject,
@@ -135,6 +136,7 @@
PCI_COMMON_CONFIG PciConfig;
NTSTATUS Status;
ULONG BytesRead;
+ PUSBQUEUE Queue;
DPRINT("CUSBHardwareDevice::Initialize\n");
@@ -151,12 +153,18 @@
//
// Create the UsbQueue class that will handle the Asynchronous and Periodic
Schedules
//
- Status = CreateUSBQueue((PUSBQUEUE*)&m_UsbQueue);
+ Status = CreateUSBQueue(&Queue);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to create UsbQueue!\n");
return Status;
}
+
+ // get ohci queue
+ m_UsbQueue = POHCIQUEUE(Queue);
+
+ // sanity check
+ ASSERT(m_UsbQueue);
//
// store device objects
@@ -205,6 +213,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::PnpStart(
PCM_RESOURCE_LIST RawResources,
PCM_RESOURCE_LIST TranslatedResources)
@@ -351,7 +360,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(this, m_Adapter, m_MemoryManager, NULL);
if (!NT_SUCCESS(Status))
{
DPRINT1("Failed to Initialize the UsbQueue\n");
@@ -383,6 +392,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::PnpStop(void)
{
UNIMPLEMENTED
@@ -390,6 +400,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetDeviceDetails(
OUT OPTIONAL PUSHORT VendorId,
OUT OPTIONAL PUSHORT DeviceId,
@@ -431,7 +442,9 @@
return STATUS_SUCCESS;
}
-NTSTATUS CUSBHardwareDevice::GetDMA(
+NTSTATUS
+STDMETHODCALLTYPE
+CUSBHardwareDevice::GetDMA(
OUT struct IDMAMemoryManager **OutDMAMemoryManager)
{
if (!m_MemoryManager)
@@ -441,6 +454,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetUSBQueue(
OUT struct IUSBQueue **OutUsbQueue)
{
@@ -636,6 +650,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetBulkHeadEndpointDescriptor(
struct _OHCI_ENDPOINT_DESCRIPTOR ** OutDescriptor)
{
@@ -643,6 +658,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetInterruptEndpointDescriptors(
struct _OHCI_ENDPOINT_DESCRIPTOR *** OutDescriptor)
{
@@ -650,6 +666,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetIsochronousHeadEndpointDescriptor(
struct _OHCI_ENDPOINT_DESCRIPTOR ** OutDescriptor)
{
@@ -657,6 +674,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::HeadEndpointDescriptorModified(
ULONG Type)
{
@@ -677,6 +695,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetControlHeadEndpointDescriptor(
struct _OHCI_ENDPOINT_DESCRIPTOR ** OutDescriptor)
{
@@ -1009,6 +1028,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::ResetPort(
IN ULONG PortIndex)
{
@@ -1018,6 +1038,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetPortStatus(
ULONG PortId,
OUT USHORT *PortStatus,
@@ -1080,6 +1101,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::ClearPortStatus(
ULONG PortId,
ULONG Status)
@@ -1154,6 +1176,7 @@
NTSTATUS
+STDMETHODCALLTYPE
CUSBHardwareDevice::SetPortFeature(
ULONG PortId,
ULONG Feature)
@@ -1244,6 +1267,7 @@
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::SetStatusChangeEndpointCallBack(
PVOID CallBack,
PVOID Context)
@@ -1253,6 +1277,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBHardwareDevice::GetCurrentFrameNumber(
PULONG FrameNumber)
{
@@ -1548,6 +1573,7 @@
}
NTSTATUS
+NTAPI
CreateUSBHardware(
PUSBHARDWAREDEVICE *OutHardware)
{
Modified: trunk/reactos/drivers/usb/usbohci/usb_queue.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usb_qu…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/usb_queue.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/usb_queue.cpp [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -11,7 +11,7 @@
#include "usbohci.h"
#include "hardware.h"
-class CUSBQueue : public IUSBQueue
+class CUSBQueue : public IOHCIQueue
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@@ -86,17 +86,25 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBQueue::Initialize(
IN PUSBHARDWAREDEVICE Hardware,
IN PDMA_ADAPTER AdapterObject,
IN PDMAMEMORYMANAGER MemManager,
IN OPTIONAL PKSPIN_LOCK Lock)
{
+ if (!Hardware)
+ {
+ // WTF
+ DPRINT1("[USBOHCI] Failed to initialize queue\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+
//
// store hardware
//
m_Hardware = POHCIHARDWAREDEVICE(Hardware);
-
+ ASSERT(m_Hardware);
//
// get bulk endpoint descriptor
@@ -288,6 +296,7 @@
NTSTATUS
+STDMETHODCALLTYPE
CUSBQueue::AddUSBRequest(
IUSBRequest * Req)
{
@@ -337,6 +346,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBQueue::CreateUSBRequest(
IUSBRequest **OutRequest)
{
@@ -696,6 +706,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBQueue::TransferDescriptorCompletionCallback(
ULONG TransferDescriptorLogicalAddress)
{
@@ -860,6 +871,7 @@
}
NTSTATUS
+STDMETHODCALLTYPE
CUSBQueue::AbortDevicePipe(
IN UCHAR DeviceAddress,
IN PUSB_ENDPOINT_DESCRIPTOR EndpointDescriptor)
@@ -973,6 +985,7 @@
NTSTATUS
+NTAPI
CreateUSBQueue(
PUSBQUEUE *OutUsbQueue)
{
Modified: trunk/reactos/drivers/usb/usbohci/usb_request.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usb_re…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/usb_request.cpp [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/usb_request.cpp [iso-8859-1] Wed Feb 29 09:15:42
2012
@@ -13,7 +13,7 @@
#include "usbohci.h"
#include "hardware.h"
-class CUSBRequest : public IUSBRequest
+class CUSBRequest : public IOHCIRequest
{
public:
STDMETHODIMP QueryInterface( REFIID InterfaceId, PVOID* Interface);
@@ -157,6 +157,7 @@
//----------------------------------------------------------------------------------------
NTSTATUS
+STDMETHODCALLTYPE
CUSBRequest::InitializeWithSetupPacket(
IN PDMAMEMORYMANAGER DmaManager,
IN PUSB_DEFAULT_PIPE_SETUP_PACKET SetupPacket,
@@ -212,6 +213,7 @@
}
//----------------------------------------------------------------------------------------
NTSTATUS
+STDMETHODCALLTYPE
CUSBRequest::InitializeWithIrp(
IN PDMAMEMORYMANAGER DmaManager,
IN struct IUSBDevice* Device,
@@ -422,6 +424,7 @@
//----------------------------------------------------------------------------------------
BOOLEAN
+STDMETHODCALLTYPE
CUSBRequest::IsRequestComplete()
{
//
@@ -443,6 +446,7 @@
}
//----------------------------------------------------------------------------------------
ULONG
+STDMETHODCALLTYPE
CUSBRequest::GetTransferType()
{
//
@@ -483,6 +487,7 @@
}
UCHAR
+STDMETHODCALLTYPE
CUSBRequest::GetInterval()
{
ASSERT(m_EndpointDescriptor);
@@ -568,6 +573,7 @@
//----------------------------------------------------------------------------------------
UCHAR
+STDMETHODCALLTYPE
CUSBRequest::GetDeviceAddress()
{
PIO_STACK_LOCATION IoStack;
@@ -1560,11 +1566,13 @@
//----------------------------------------------------------------------------------------
NTSTATUS
+STDMETHODCALLTYPE
CUSBRequest::GetEndpointDescriptor(
struct _OHCI_ENDPOINT_DESCRIPTOR ** OutDescriptor)
{
ULONG TransferType;
NTSTATUS Status;
+
//
// get transfer type
@@ -1592,6 +1600,8 @@
break;
}
+
+
if (NT_SUCCESS(Status))
{
//
@@ -1613,6 +1623,7 @@
//----------------------------------------------------------------------------------------
VOID
+STDMETHODCALLTYPE
CUSBRequest::GetResultStatus(
OUT OPTIONAL NTSTATUS * NtStatusCode,
OUT OPTIONAL PULONG UrbStatusCode)
@@ -1646,6 +1657,7 @@
}
VOID
+STDMETHODCALLTYPE
CUSBRequest::FreeEndpointDescriptor(
struct _OHCI_ENDPOINT_DESCRIPTOR * OutDescriptor)
{
@@ -1878,12 +1890,10 @@
TransferDescriptor =
(POHCI_GENERAL_TD)TransferDescriptor->NextLogicalDescriptor;
}
}
-
-
-
}
VOID
+STDMETHODCALLTYPE
CUSBRequest::CompletionCallback()
{
PIO_STACK_LOCATION IoStack;
@@ -1943,20 +1953,9 @@
}
}
-#if 0
-//-----------------------------------------------------------------------------------------
-BOOLEAN
-CUSBRequest::IsQueueHeadComplete(
- struct _QUEUE_HEAD * QueueHead)
-{
- UNIMPLEMENTED
- return TRUE;
-}
-#endif
-
-
//-----------------------------------------------------------------------------------------
NTSTATUS
+NTAPI
InternalCreateUSBRequest(
PUSBREQUEST *OutRequest)
{
Modified: trunk/reactos/drivers/usb/usbohci/usbohci.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbohci/usbohc…
==============================================================================
--- trunk/reactos/drivers/usb/usbohci/usbohci.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbohci/usbohci.h [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -59,20 +59,23 @@
(VOID)((!(exp)) ? \
RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
+extern "C"
+{
+
//
// hardware.cpp
//
-NTSTATUS CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware);
+NTSTATUS NTAPI CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware);
//
// usb_queue.cpp
//
-NTSTATUS CreateUSBQueue(PUSBQUEUE *OutUsbQueue);
+NTSTATUS NTAPI CreateUSBQueue(PUSBQUEUE *OutUsbQueue);
//
// usb_request.cpp
//
-NTSTATUS InternalCreateUSBRequest(PUSBREQUEST *OutRequest);
-
+NTSTATUS NTAPI InternalCreateUSBRequest(PUSBREQUEST *OutRequest);
+}
#endif
Modified: trunk/reactos/lib/drivers/libusb/hcd_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/hcd_con…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/hcd_controller.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/hcd_controller.cpp [iso-8859-1] Wed Feb 29 09:15:42
2012
@@ -747,6 +747,7 @@
}
NTSTATUS
+NTAPI
CreateHCDController(
PHCDCONTROLLER *OutHcdController)
{
Modified: trunk/reactos/lib/drivers/libusb/hub_controller.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/hub_con…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/hub_controller.cpp [iso-8859-1] Wed Feb 29 09:15:42
2012
@@ -3718,6 +3718,7 @@
NTSTATUS
+NTAPI
CreateHubController(
PHUBCONTROLLER *OutHcdController)
{
Modified: trunk/reactos/lib/drivers/libusb/libusb.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/libusb.…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/libusb.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/libusb.cpp [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -16,6 +16,9 @@
//
DRIVER_ADD_DEVICE USBLIB_AddDevice;
+extern
+"C"
+{
NTSTATUS
NTAPI
USBLIB_AddDevice(
@@ -54,7 +57,11 @@
return Status;
}
+}
+extern
+"C"
+{
NTSTATUS
NTAPI
USBLIB_Dispatch(
@@ -121,3 +128,4 @@
return Status;
}
+}
Modified: trunk/reactos/lib/drivers/libusb/libusb.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/libusb.…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/libusb.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/libusb.h [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -66,35 +66,31 @@
RtlAssert((PVOID) #exp, (PVOID)__FILE__, __LINE__, NULL ), FALSE : TRUE)
// hcd_controller.cpp
-NTSTATUS CreateHCDController(PHCDCONTROLLER *HcdController);
+extern "C"
+{
+NTSTATUS NTAPI CreateHCDController(PHCDCONTROLLER *HcdController);
// hardware.cpp
-NTSTATUS CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware);
+NTSTATUS NTAPI CreateUSBHardware(PUSBHARDWAREDEVICE *OutHardware);
// misc.cpp
NTSTATUS NTAPI SyncForwardIrp(PDEVICE_OBJECT DeviceObject, PIRP Irp);
NTSTATUS NTAPI GetBusInterface(PDEVICE_OBJECT DeviceObject, PBUS_INTERFACE_STANDARD
busInterface);
// root_hub_controller.cpp
-NTSTATUS CreateHubController(PHUBCONTROLLER * OutHubController);
+NTSTATUS NTAPI CreateHubController(PHUBCONTROLLER * OutHubController);
// memory_manager.cpp
-NTSTATUS CreateDMAMemoryManager(PDMAMEMORYMANAGER *OutMemoryManager);
-
+NTSTATUS NTAPI CreateDMAMemoryManager(PDMAMEMORYMANAGER *OutMemoryManager);
// usb_device.cpp
-NTSTATUS CreateUSBDevice(PUSBDEVICE *OutDevice);
-
-// usb_queue.cpp
-NTSTATUS CreateUSBQueue(PUSBQUEUE *OutUsbQueue);
-
-// usb_request.cpp
-NTSTATUS InternalCreateUSBRequest(PUSBREQUEST *OutRequest);
+NTSTATUS NTAPI CreateUSBDevice(PUSBDEVICE *OutDevice);
// libusb.cpp
NTSTATUS NTAPI USBLIB_AddDevice(PDRIVER_OBJECT DriverObject, PDEVICE_OBJECT
PhysicalDeviceObject);
NTSTATUS NTAPI USBLIB_Dispatch(PDEVICE_OBJECT DeviceObject, PIRP Irp);
+}
#endif
Modified: trunk/reactos/lib/drivers/libusb/memory_manager.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/memory_…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/memory_manager.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/memory_manager.cpp [iso-8859-1] Wed Feb 29 09:15:42
2012
@@ -335,6 +335,7 @@
}
NTSTATUS
+NTAPI
CreateDMAMemoryManager(
PDMAMEMORYMANAGER *OutMemoryManager)
{
Modified: trunk/reactos/lib/drivers/libusb/usb_device.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/libusb/usb_dev…
==============================================================================
--- trunk/reactos/lib/drivers/libusb/usb_device.cpp [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/libusb/usb_device.cpp [iso-8859-1] Wed Feb 29 09:15:42 2012
@@ -1183,6 +1183,7 @@
//----------------------------------------------------------------------------------------
NTSTATUS
+NTAPI
CreateUSBDevice(
PUSBDEVICE *OutDevice)
{