mirror of
https://github.com/reactos/reactos.git
synced 2025-04-04 20:50:41 +00:00
[LIBUSB]
- Perform intialization of root hub in a worker thread - Should help ReactOS to continue booting when an usb controller causes hangs svn path=/trunk/; revision=59605
This commit is contained in:
parent
4e8dea09fb
commit
d1c2395c8b
2 changed files with 53 additions and 2 deletions
|
@ -3351,6 +3351,31 @@ USBHI_Initialize20Hub(
|
|||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
WORKER_THREAD_ROUTINE InitRootHub;
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
InitRootHub(IN PVOID Context)
|
||||
{
|
||||
PINIT_ROOT_HUB_CONTEXT WorkItem;
|
||||
|
||||
//
|
||||
// get context
|
||||
//
|
||||
WorkItem = (PINIT_ROOT_HUB_CONTEXT)Context;
|
||||
|
||||
//
|
||||
// perform callback
|
||||
//
|
||||
WorkItem->CallbackRoutine(WorkItem->CallbackContext);
|
||||
|
||||
//
|
||||
// free contextg
|
||||
//
|
||||
ExFreePoolWithTag(Context, TAG_USBLIB);
|
||||
}
|
||||
|
||||
NTSTATUS
|
||||
USB_BUSIFFN
|
||||
USBHI_RootHubInitNotification(
|
||||
|
@ -3359,6 +3384,7 @@ USBHI_RootHubInitNotification(
|
|||
PRH_INIT_CALLBACK CallbackRoutine)
|
||||
{
|
||||
CHubController * Controller;
|
||||
PINIT_ROOT_HUB_CONTEXT WorkItem;
|
||||
|
||||
DPRINT("USBHI_RootHubInitNotification %p \n", CallbackContext);
|
||||
|
||||
|
@ -3374,9 +3400,26 @@ USBHI_RootHubInitNotification(
|
|||
Controller->SetNotification(CallbackContext, CallbackRoutine);
|
||||
|
||||
//
|
||||
// FIXME: determine when to perform callback
|
||||
// Create and initialize work item data
|
||||
//
|
||||
CallbackRoutine(CallbackContext);
|
||||
WorkItem = (PINIT_ROOT_HUB_CONTEXT)ExAllocatePoolWithTag(NonPagedPool, sizeof(INIT_ROOT_HUB_CONTEXT), TAG_USBLIB);
|
||||
if (!WorkItem)
|
||||
{
|
||||
DPRINT1("Failed to allocate memory!n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
//
|
||||
// init context
|
||||
//
|
||||
WorkItem->CallbackRoutine = CallbackRoutine;
|
||||
WorkItem->CallbackContext = CallbackContext;
|
||||
|
||||
//
|
||||
// Queue the work item to handle initializing the device
|
||||
//
|
||||
ExInitializeWorkItem(&WorkItem->WorkItem, InitRootHub, (PVOID)WorkItem);
|
||||
ExQueueWorkItem(&WorkItem->WorkItem, DelayedWorkQueue);
|
||||
|
||||
//
|
||||
// done
|
||||
|
|
|
@ -52,6 +52,14 @@ typedef struct
|
|||
PDISPATCHIRP Dispatcher; // dispatches the code
|
||||
}COMMON_DEVICE_EXTENSION, *PCOMMON_DEVICE_EXTENSION;
|
||||
|
||||
|
||||
typedef struct _WORK_ITEM_DATA
|
||||
{
|
||||
WORK_QUEUE_ITEM WorkItem; // work item
|
||||
PVOID CallbackContext; // callback context
|
||||
PRH_INIT_CALLBACK CallbackRoutine; // callback routine
|
||||
} INIT_ROOT_HUB_CONTEXT, *PINIT_ROOT_HUB_CONTEXT;
|
||||
|
||||
//
|
||||
// tag for allocations
|
||||
//
|
||||
|
|
Loading…
Reference in a new issue