Author: mjmartin
Date: Tue Feb 23 12:20:15 2010
New Revision: 45668
URL:
http://svn.reactos.org/svn/reactos?rev=45668&view=rev
Log:
[usb/usbehci]
- Add back WorkItem code but use it for calling the hub drivers callback routine (telling
hub driver it needs check port status).
- Add missing break for case URB_FUNCTION_GET_STATUS_FROM_DEVICE.
- RootHubInitNotification: BusContext is the Device Object not the Device Objects
Extensions.
- UsbEhci now receives URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER IN requests,
which is where we want to be for informing hub driver which port a device has been
connected.
Modified:
trunk/reactos/drivers/usb/usbehci/fdo.c
trunk/reactos/drivers/usb/usbehci/irp.c
trunk/reactos/drivers/usb/usbehci/usbehci.h
trunk/reactos/drivers/usb/usbehci/usbiffn.c
Modified: trunk/reactos/drivers/usb/usbehci/fdo.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/fdo.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/fdo.c [iso-8859-1] Tue Feb 23 12:20:15 2010
@@ -14,6 +14,24 @@
//#include "ntstrsafe.h"
VOID NTAPI
+DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context)
+{
+ PWORKITEM_DATA WorkItemData;
+ PPDO_DEVICE_EXTENSION PdoDeviceExtension;
+
+ WorkItemData = (PWORKITEM_DATA)Context;
+ PdoDeviceExtension = (PPDO_DEVICE_EXTENSION) DeviceObject->DeviceExtension;
+
+ if (PdoDeviceExtension->CallbackRoutine)
+ PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
+ else
+ DPRINT1("PdoDeviceExtension->CallbackRoutine is NULL!\n");
+
+ IoFreeWorkItem(WorkItemData->IoWorkItem);
+ ExFreePool(WorkItemData);
+}
+
+VOID NTAPI
EhciDefferedRoutine(PKDPC Dpc, PVOID DeferredContext, PVOID SystemArgument1, PVOID
SystemArgument2)
{
PFDO_DEVICE_EXTENSION FdoDeviceExtension;
@@ -42,6 +60,7 @@
/* Check for port change on this port */
if (tmp & 0x02)
{
+ PWORKITEM_DATA WorkItemData = NULL;
/* Connect or Disconnect? */
if (tmp & 0x01)
{
@@ -84,7 +103,14 @@
DPRINT("port tmp %x\n", tmp);
GetDeviceDescriptor(FdoDeviceExtension, 0, 0, FALSE);
PdoDeviceExtension->ChildDeviceCount++;
-
//PdoDeviceExtension->CallbackRoutine(PdoDeviceExtension->CallbackContext);
+ WorkItemData = ExAllocatePool(NonPagedPool, sizeof(WORKITEM_DATA));
+ if (!WorkItemData) ASSERT(FALSE);
+ WorkItemData->IoWorkItem =
IoAllocateWorkItem(PdoDeviceExtension->DeviceObject);
+ WorkItemData->PdoDeviceExtension = PdoDeviceExtension;
+ IoQueueWorkItem(WorkItemData->IoWorkItem,
+ (PIO_WORKITEM_ROUTINE)DeviceArrivalWorkItem,
+ DelayedWorkQueue,
+ WorkItemData);
}
else
{
Modified: trunk/reactos/drivers/usb/usbehci/irp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/irp.c?…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/irp.c [iso-8859-1] Tue Feb 23 12:20:15 2010
@@ -92,12 +92,24 @@
{
case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
{
- /* We should not get here yet! */
- ASSERT(FALSE);
+ /* Are we suppose to only return on this request when a device is
connected
+ or is it the RootHubInitNotification Callback */
+ DPRINT1("URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:\n");
+ DPRINT1("--->TransferBufferLength
%x\n",Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
+ DPRINT1("--->TransferBuffer
%x\n",Urb->UrbBulkOrInterruptTransfer.TransferBuffer);
+ DPRINT1("--->PipeHandle
%x\n",Urb->UrbBulkOrInterruptTransfer.PipeHandle);
+ DPRINT1("--->TransferFlags %x\n",
Urb->UrbBulkOrInterruptTransfer.TransferFlags);
+ /* FIXME */
+ RtlZeroMemory(Urb->UrbBulkOrInterruptTransfer.TransferBuffer,
Urb->UrbBulkOrInterruptTransfer.TransferBufferLength);
+ ((PUCHAR)Urb->UrbBulkOrInterruptTransfer.TransferBuffer)[0] = 1;
+ /* Turn off Irp handling as nothing is handled beyond this */
+ DeviceExtension->HaltUrbHandling = TRUE;
+ break;
}
case URB_FUNCTION_GET_STATUS_FROM_DEVICE:
{
DPRINT1("Get Status from Device\n");
+ break;
}
case URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE:
{
@@ -320,8 +332,6 @@
Urb->UrbHeader.Status = USBD_STATUS_SUCCESS;
Urb->UrbHeader.UsbdDeviceHandle = UsbDevice;
Urb->UrbHeader.UsbdFlags = 0;
- /* Stop handling the URBs now as its not coded yet */
- //DeviceExtension->HaltUrbHandling = TRUE;
break;
}
default:
@@ -420,3 +430,4 @@
KeReleaseSpinLock(&DeviceExtension->IrpQueueLock, oldIrql);
}
+
Modified: trunk/reactos/drivers/usb/usbehci/usbehci.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbehc…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usbehci.h [iso-8859-1] Tue Feb 23 12:20:15 2010
@@ -363,7 +363,7 @@
typedef struct _WORKITEM_DATA
{
PIO_WORKITEM IoWorkItem;
- PFDO_DEVICE_EXTENSION FdoDeviceExtension;
+ PPDO_DEVICE_EXTENSION PdoDeviceExtension;
PDEVICE_OBJECT PortDeviceObject;
} WORKITEM_DATA, *PWORKITEM_DATA;
@@ -419,4 +419,7 @@
VOID
URBRequestCancel (PDEVICE_OBJECT DeviceObject, PIRP Irp);
+VOID NTAPI
+DeviceArrivalWorkItem(PDEVICE_OBJECT DeviceObject, PVOID Context);
+
#endif
Modified: trunk/reactos/drivers/usb/usbehci/usbiffn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/usb/usbehci/usbiff…
==============================================================================
--- trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/usb/usbehci/usbiffn.c [iso-8859-1] Tue Feb 23 12:20:15 2010
@@ -188,7 +188,7 @@
PPDO_DEVICE_EXTENSION PdoDeviceExtension;
DPRINT1("RootHubInitNotification %x, %x, %x\n", BusContext,
CallbackContext, CallbackRoutine);
- PdoDeviceExtension = (PPDO_DEVICE_EXTENSION)BusContext;
+ PdoDeviceExtension =
(PPDO_DEVICE_EXTENSION)((PDEVICE_OBJECT)BusContext)->DeviceExtension;
PdoDeviceExtension->CallbackContext = CallbackContext;
PdoDeviceExtension->CallbackRoutine = CallbackRoutine;
return STATUS_SUCCESS;