- Missed a fix from last commit
- Wait for the device status change work item to complete
- The USB stack is now properly constructed for USB booting

svn path=/branches/usb-bringup-trunk/; revision=55339
This commit is contained in:
Cameron Gutman 2012-01-30 22:45:16 +00:00
parent 475fe08f3c
commit be54f427e6
2 changed files with 18 additions and 21 deletions

View file

@ -260,8 +260,6 @@ DeviceStatusChangeThread(
PORT_STATUS_CHANGE PortStatus;
LONG PortId;
static LONG failsafe = 0;
DPRINT1("Entered DeviceStatusChangeThread, Context %x\n", Context);
WorkItemData = (PWORK_ITEM_DATA)Context;
@ -408,20 +406,7 @@ DeviceStatusChangeThread(
}
}
//
// FIXME: Still in testing
//
failsafe++;
if (failsafe > 100)
{
DPRINT1("SCE completed over 100 times but no action has been taken to clear the Change of any ports.\n");
//
// Return and dont send any more SCE Requests
//
return;
}
ExFreePool(WorkItemData);
KeSetEvent(&WorkItemData->Event, IO_NO_INCREMENT, FALSE);
//
// Send another SCE Request
@ -460,6 +445,7 @@ StatusChangeEndpointCompletion(
return STATUS_INSUFFICIENT_RESOURCES;
}
WorkItemData->Context = RealDeviceObject;
KeInitializeEvent(&WorkItemData->Event, NotificationEvent, FALSE);
DPRINT1("Initialize work item\n");
ExInitializeWorkItem(&WorkItemData->WorkItem, DeviceStatusChangeThread, (PVOID)WorkItemData);
@ -468,6 +454,16 @@ StatusChangeEndpointCompletion(
//
ExQueueWorkItem(&WorkItemData->WorkItem, DelayedWorkQueue);
//
// Wait for the work item
//
KeWaitForSingleObject(&WorkItemData->Event,
Executive,
KernelMode,
FALSE,
NULL);
ExFreePool(WorkItemData);
//
// Return more processing required so the IO Manger doesnt try to mess with IRP just freed
//
@ -1823,6 +1819,11 @@ USBHUB_FdoHandlePnp(
}
else
{
//
// Send the first SCE Request
//
QueryStatusChangeEndpoint(DeviceObject);
//
// reset ports
//
@ -1848,11 +1849,6 @@ USBHUB_FdoHandlePnp(
}
}
}
//
// Send the first SCE Request
//
QueryStatusChangeEndpoint(DeviceObject);
}
ExFreePool(Urb);

View file

@ -44,6 +44,7 @@ typedef struct _PORT_STATUS_CHANGE
typedef struct _WORK_ITEM_DATA
{
WORK_QUEUE_ITEM WorkItem;
KEVENT Event;
PVOID Context;
} WORK_ITEM_DATA, *PWORK_ITEM_DATA;