From e8e064d26e11edfa73652b8367af00fd0c25cbd4 Mon Sep 17 00:00:00 2001 From: stansmith Date: Wed, 9 Apr 2008 14:57:54 +0000 Subject: [PATCH] [WinVerbs] still needs ioctl work git-svn-id: svn://openib.tc.cornell.edu/gen1@1048 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- branches/winverbs/core/bus/kmdf/bus_driver.h | 9 + branches/winverbs/core/bus/kmdf/bus_pnp.c | 566 +++---------------- 2 files changed, 76 insertions(+), 499 deletions(-) diff --git a/branches/winverbs/core/bus/kmdf/bus_driver.h b/branches/winverbs/core/bus/kmdf/bus_driver.h index 91abe0bb..1a2033d0 100644 --- a/branches/winverbs/core/bus/kmdf/bus_driver.h +++ b/branches/winverbs/core/bus/kmdf/bus_driver.h @@ -237,6 +237,15 @@ typedef struct _bus_fdo_ext WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(FDO_BUS_DATA, FdoGetData) +typedef struct _request_context { + int foo; + int foo2; + +} REQUEST_CONTEXT, *PREQUEST_CONTEXT; + +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(REQUEST_CONTEXT, RequestGetContext) + + // General purpose workitem context used in dispatching work to // system worker thread to be executed at PASSIVE_LEVEL. diff --git a/branches/winverbs/core/bus/kmdf/bus_pnp.c b/branches/winverbs/core/bus/kmdf/bus_pnp.c index 4feb95d0..52ed691c 100644 --- a/branches/winverbs/core/bus/kmdf/bus_pnp.c +++ b/branches/winverbs/core/bus/kmdf/bus_pnp.c @@ -62,24 +62,23 @@ EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_CLEANUP EVT_WDF_CHILD_LIST_IDENTIFICATION_DESCRIPTION_DUPLICATE Bus_ChildListIdentificationDescriptionDuplicate; -EVT_WDF_DEVICE_SELF_MANAGED_IO_INIT Bus_EvtDeviceSelfManagedIoInit; -EVT_WDF_DEVICE_SELF_MANAGED_IO_CLEANUP Bus_EvtDeviceSelfManagedIoCleanup; -EVT_WDF_DEVICE_SELF_MANAGED_IO_SUSPEND Bus_EvtDeviceSelfManagedIoSuspend; -EVT_WDF_DEVICE_SELF_MANAGED_IO_RESTART Bus_EvtDeviceSelfManagedIoRestart; -EVT_WDF_DEVICE_SURPRISE_REMOVAL Bus_EvtDeviceSurpriseRemoval; -EVT_WDF_DEVICE_QUERY_REMOVE Bus_EvtDeviceQueryRemove; -EVT_WDF_DEVICE_QUERY_STOP Bus_EvtDeviceQueryStop; - -EVT_WDF_DEVICE_USAGE_NOTIFICATION Bus_EvtDeviceUsageNotify; EVT_WDF_DEVICE_RELATIONS_QUERY Bus_EvtDeviceRelationsQuery; static VOID Bus_EvtDriverCleanup( IN WDFOBJECT Driver ); +#ifdef NOT_YET static VOID Bus_EvtDeviceObjContextCleanup ( IN WDFOBJECT Object ); +static VOID +Bus_EvtIoStop ( + IN WDFQUEUE Queue, + IN WDFREQUEST Request, + IN ULONG ActionFlags ); +#endif + static VOID Bus_EvtIoDeviceControl( IN WDFQUEUE Queue, @@ -88,16 +87,6 @@ Bus_EvtIoDeviceControl( IN size_t InputBufferLength, IN ULONG IoControlCode ); -static VOID -Bus_EvtIoStop ( - IN WDFQUEUE Queue, - IN WDFREQUEST Request, - IN ULONG ActionFlags ); - -static VOID -Bus_EvtDeviceFileCreate ( IN WDFDEVICE Device, - IN WDFREQUEST Request, - IN WDFFILEOBJECT FileObject ); // implies extern EVT_WDF_FILE_CLOSE EvtDeviceFileClose; static VOID @@ -194,14 +183,10 @@ __fdo_set_power( /* All PnP code is called at passive, so it can all be paged out. */ #ifdef ALLOC_PRAGMA #pragma alloc_text (PAGE, Bus_EvtDeviceAdd) -#pragma alloc_text (PAGE, Bus_EvtIoDeviceControl) -#pragma alloc_text (PAGE, Bus_EvtIoStop) #pragma alloc_text (PAGE, Bus_EvtDriverCleanup) #pragma alloc_text (PAGE, Bus_EvtDevicePrepareHardware) #pragma alloc_text (PAGE, Bus_EvtDeviceReleaseHardware) -#pragma alloc_text (PAGE, Bus_EvtDeviceFileCreate) -#pragma alloc_text (PAGE, Bus_EvtDeviceFileClose) -#pragma alloc_text (PAGE, Bus_EvtDeviceFileCleanup) +#pragma alloc_text (PAGE, Bus_EvtIoDeviceControl) #pragma alloc_text (PAGE, fdo_start) #pragma alloc_text (PAGE, fdo_query_remove) @@ -253,7 +238,7 @@ static const cl_vfptr_pnp_po_t vfptr_fdo_pnp = { }; -#ifdef _REPLACED +#ifdef _REPLACED // original code - see Bus_EvtDeviceAdd() NTSTATUS bus_add_device( @@ -349,6 +334,7 @@ bus_add_device( } #endif + static NTSTATUS GetDeviceUnicodeName( WDFDEVICE Device, const GUID *guid, PUNICODE_STRING dst ) { @@ -367,7 +353,8 @@ GetDeviceUnicodeName( WDFDEVICE Device, const GUID *guid, PUNICODE_STRING dst ) if (!NT_SUCCESS(status)) return status; - WdfStringGetUnicodeString( string, dst ); + if ( dst ) + WdfStringGetUnicodeString( string, dst ); return STATUS_SUCCESS; } @@ -399,10 +386,9 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, NTSTATUS status; WDFDEVICE device; WDF_CHILD_LIST_CONFIG config; - WDF_FILEOBJECT_CONFIG FileObjConfig; WDF_OBJECT_ATTRIBUTES Attributes; WDF_IO_QUEUE_CONFIG queueConfig; - PNP_BUS_INFORMATION busInfo; +// XXX PNP_BUS_INFORMATION busInfo; WDFQUEUE queue; FDO_BUS_DATA *p_ext; UNICODE_STRING dev_name, dos_name; @@ -421,7 +407,7 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, return STATUS_NO_SUCH_DEVICE; } -#ifdef NOT_YET +#ifdef NOT_YET // XXX fixup for IB fabric device // // Get some property of the device you are about to attach and check // to see if that's the one you are interested. For demonstration @@ -437,7 +423,6 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, KdPrint(("Failed to get the property of PDO: 0x%p\n", DeviceInit)); } -#endif // // Tell the framework that you are filter driver. Framework @@ -445,9 +430,33 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, // from the lower device you are attaching to. // Lower device Guid is specified in ib_bus.inx - WdfFdoInitSetFilter(DeviceInit); + // XXX - need context per hca - CA ptr & ?? + + //WdfFdoInitSetFilter(DeviceInit); +#endif - // initialize names for the IBAL interface +#ifdef NOT_YET + status = RtlUnicodeStringPrintf(&deviceName, L"%ws%d", + L"\\Device\\Serial", + currentInstance++); + + if (!NT_SUCCESS(status)) { + return status; + } + + status = WdfDeviceInitAssignName(DeviceInit,& deviceName); + if (!NT_SUCCESS(status)) { + return status; + } +#endif + + // set the request context size attribute + + WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, REQUEST_CONTEXT); + + WdfDeviceInitSetRequestAttributes(DeviceInit, &Attributes); + + // initialize names for the IBAL interface XXX stati unicode strings RtlInitUnicodeString( &dev_name, AL_DEVICE_NAME ); RtlInitUnicodeString( &dos_name, L"\\DosDevices\\Global\\ibal" ); @@ -457,7 +466,6 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, // you are okay with the defaults. WdfDeviceInitSetDeviceType(DeviceInit, FILE_DEVICE_BUS_EXTENDER); - //WdfDeviceInitSetExclusive(DeviceInit, TRUE); XXX? // This is an InifiniBand bus enumerator, we need to register for those // PNP/Power callbacks of interest. Framework will take the default action @@ -475,39 +483,13 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, // hardware. Drivers derived from this sample will often be able to // provide only some of these. - // This next group of five callbacks allow a driver to become involved in - // starting and stopping operations within a driver as the driver moves - // through various PnP/Power states. These functions are not necessary - // if the Framework is managing all the device's queues and there is no - // activity going on that isn't queue-based. - - pnpPowerCallbacks.EvtDeviceSelfManagedIoInit = - Bus_EvtDeviceSelfManagedIoInit; - pnpPowerCallbacks.EvtDeviceSelfManagedIoCleanup = - Bus_EvtDeviceSelfManagedIoCleanup; - pnpPowerCallbacks.EvtDeviceSelfManagedIoSuspend = - Bus_EvtDeviceSelfManagedIoSuspend; - pnpPowerCallbacks.EvtDeviceSelfManagedIoRestart = - Bus_EvtDeviceSelfManagedIoRestart; - - // These two callbacks set up and tear down hardware state, - // specifically that which only has to be done once. - - pnpPowerCallbacks.EvtDevicePrepareHardware = Bus_EvtDevicePrepareHardware; - pnpPowerCallbacks.EvtDeviceReleaseHardware = Bus_EvtDeviceReleaseHardware; - // These two callbacks set up and tear down hardware state that must be // done every time the device moves in and out of the D0-working state. // (aka, start & stop the device). - pnpPowerCallbacks.EvtDeviceD0Entry = Bus_EvtDeviceD0Entry; - pnpPowerCallbacks.EvtDeviceD0Exit = Bus_EvtDeviceD0Exit; - - pnpPowerCallbacks.EvtDeviceQueryStop = Bus_EvtDeviceQueryStop; - pnpPowerCallbacks.EvtDeviceQueryRemove = Bus_EvtDeviceQueryRemove; - pnpPowerCallbacks.EvtDeviceSurpriseRemoval = Bus_EvtDeviceSurpriseRemoval; + //pnpPowerCallbacks.EvtDeviceD0Entry = Bus_EvtDeviceD0Entry; + //pnpPowerCallbacks.EvtDeviceD0Exit = Bus_EvtDeviceD0Exit; -// pnpPowerCallbacks.EvtDeviceUsageNotification = Bus_EvtDeviceUsageNotify; pnpPowerCallbacks.EvtDeviceRelationsQuery = Bus_EvtDeviceRelationsQuery; // Register the PnP and power callbacks. @@ -569,31 +551,23 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, WDF_NO_OBJECT_ATTRIBUTES); - // setup callbacks to hande IRP_MJ_CREATE & IRP_MJ_CLOSE - - WDF_FILEOBJECT_CONFIG_INIT( - &FileObjConfig, - Bus_EvtDeviceFileCreate, - Bus_EvtDeviceFileClose, - Bus_EvtDeviceFileCleanup ); - WDF_OBJECT_ATTRIBUTES_INIT(&Attributes); - Attributes.SynchronizationScope = WdfSynchronizationScopeNone; - Attributes.ExecutionLevel = WdfExecutionLevelPassive; - +#if 0 WdfDeviceInitSetFileObjectConfig( DeviceInit, - &FileObjConfig, + XXX, &Attributes ); +#endif // Initialize attributes structure to specify size and accessor function // for storing device context. WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&Attributes, FDO_BUS_DATA); + // Register a cleanup callback on the device to free up some resources at // the time the device is deleted. - Attributes.EvtCleanupCallback = Bus_EvtDeviceObjContextCleanup; + // Attributes.EvtCleanupCallback = Bus_EvtDeviceObjContextCleanup; // By opting for SynchronizationScopeDevice, we tell the framework to // synchronize callbacks events of all the objects directly associated @@ -601,7 +575,9 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, // By doing that we don't have to worrry about synchronizing // access to device-context by various io Events. // Framework will serialize them by using an internal device-lock. + Attributes.SynchronizationScope = WdfSynchronizationScopeDevice; + Attributes.ExecutionLevel = WdfExecutionLevelPassive; // Create a framework device object. In response to this call, framework // creates a WDM deviceobject and attaches to the PDO. @@ -634,7 +610,6 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, // handle IRP_MJ_DEVICE_CONTROL with this callback queueConfig.EvtIoDeviceControl = Bus_EvtIoDeviceControl; - queueConfig.EvtIoStop = Bus_EvtIoStop; status = WdfIoQueueCreate( device, &queueConfig, @@ -706,14 +681,14 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, } status = GetDeviceUnicodeName( device, (const GUID*)&GUID_IB_AL_INTERFACE, - NULL ); + &p_ext->al_ifc_name ); if (!NT_SUCCESS(status)) { BUS_TRACE_EXIT(BUS_DBG_ERROR, ("GetDeviceUnicodeName() ret %x\n", status)); return status; } -#if 1 +#if 0 // New approach - requires modifications in mthca to // not co-install this driver (ibbus.sys) // not call up for the IB_CI_INTERFACE. @@ -738,6 +713,7 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, return status /*STATUS_NO_SUCH_DEVICE*/; } +// XXX remove name creation code..... status = GetDeviceUnicodeName( device, (const GUID*)&GUID_IB_CI_INTERFACE, &p_ext->ci_ifc_name ); @@ -750,6 +726,7 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, bus_globals.p_bus_ext = p_ext; // save our FDO data extension ptr. +#if 0 // XXX get HCA PCI bus info and set for children... // // This value is used in responding to the IRP_MN_QUERY_BUS_INFORMATION // for the child devices. This is an optional information provided to @@ -767,6 +744,7 @@ Bus_EvtDeviceAdd( IN WDFDRIVER Driver, ("Bus_WmiRegistration() failed returned 0x%08x\n", status) ); return status; } +#endif KdPrint(("<-- %s(): 0x%p status 0x%x\n", __FUNCTION__, Driver, status)); @@ -1928,14 +1906,18 @@ Bus_EvtIoDeviceControl ( PIRP irp; PIO_STACK_LOCATION NextStack; WDFIOTARGET hTarget; + REQUEST_CONTEXT *context; UNREFERENCED_PARAMETER(OutputBufferLength); UNREFERENCED_PARAMETER(InputBufferLength); - BUS_ENTER( DBG_PNP ); + KdPrint(("--> %s() IOCTL 0x%x\n", __FUNCTION__, IoControlCode)); + // BUS_ENTER( DBG_PNP ); PAGED_CODE (); + context = RequestGetContext(Request); + hDevice = WdfIoQueueGetDevice(Queue); KdPrint(("%s() 0x%p IOCTL 0x%x\n", __FUNCTION__, hDevice,IoControlCode)); @@ -1944,7 +1926,8 @@ Bus_EvtIoDeviceControl ( //CurStack = IoGetCurrentIrpStackLocation(irp); - status = cl_to_ntstatus( al_dev_ioctl( irp ) ); + status = al_dev_ioctl2( irp, (void*)context ); + switch( status ) { case STATUS_SUCCESS: @@ -1953,6 +1936,7 @@ Bus_EvtIoDeviceControl ( case STATUS_INVALID_DEVICE_REQUEST: // pass down the stack? +// WdfRequestFormatRequestUsingCurrentType() hTarget = WdfDeviceGetIoTarget(hDevice); if ( hTarget ) { @@ -1971,7 +1955,8 @@ Bus_EvtIoDeviceControl ( break; default: - WdfRequestComplete(Request, status); + KdPrint(("%s() default\n",__FUNCTION__)); + // not needed WdfRequestComplete(Request, status); break; } @@ -2066,26 +2051,6 @@ Bus_EvtIoDeviceControl ( } -static VOID -Bus_EvtIoStop ( - IN WDFQUEUE Queue, - IN WDFREQUEST Request, - IN ULONG ActionFlags ) -{ - UNREFERENCED_PARAMETER( Queue ); - UNREFERENCED_PARAMETER( Request ); - UNREFERENCED_PARAMETER( ActionFlags ); - - BUS_ENTER( DBG_PNP ); - - /*request's I/O queue is being stopped */ - WdfRequestComplete( Request, STATUS_CANCELLED ); - - - BUS_EXIT( DBG_PNP ); -} - - /*++ Routine Description: @@ -2810,404 +2775,6 @@ Bus_EvtDeviceD0Exit ( } -/*++ - -Routine Description: - - The framework calls a driver's EvtDeviceFileCreate callback when the - framework receives an IRP_MJ_CREATE request. - The system sends this request when a user application opens the - device to perform an I/O operation, such as reading or writing to a device. - This callback is called in the context of the thread - that created the IRP_MJ_CREATE request. - -Arguments: - - Device - Handle to a framework device object. - FileObject - Pointer to fileobject that represents the open handle. - CreateParams - Parameters for create - -Return Value: - - NT status code - ---*/ - -static VOID -Bus_EvtDeviceFileCreate ( IN WDFDEVICE Device, - IN WDFREQUEST Request, - IN WDFFILEOBJECT FileObject ) -{ - PFDO_BUS_DATA fdoData; - - UNREFERENCED_PARAMETER(FileObject); - - KdPrint(("%s() --> Dev %p\n", __FUNCTION__, Device)); - - PAGED_CODE (); - - // - // Get the device context given the device handle. - // - fdoData = FdoGetData(Device); - - WdfRequestComplete(Request, STATUS_SUCCESS); - - KdPrint(("%s() <--\n",__FUNCTION__)); - return; -} - - - -/*++ - -Routine Description: - - EvtFileClose is the dispatch routine for IRP_MJ_CLOSE. It is called when all - the handles represented by the FileObject are closed and all the references - to FileObject are removed. - - This callback may get called in an arbitrary thread context instead of the - thread that called CloseHandle. If you want to delete any per FileObject - context that must be done in the context of the user thread that made the - Create call, you should do that in the EvtDeviceCleanup callback. - -Arguments: - - FileObject - Pointer to fileobject that represents the open handle. - -Return Value: - - ---*/ - -static VOID -Bus_EvtDeviceFileClose ( IN WDFFILEOBJECT FileObject ) -{ - PFDO_BUS_DATA fdoData; - - PAGED_CODE (); - - KdPrint(("%s()--->\n",__FUNCTION__)); - - fdoData = FdoGetData(WdfFileObjectGetDevice(FileObject)); - - KdPrint(("%s()<---\n",__FUNCTION__)); - - return; -} - - -/*++ - -Routine Description: - - EvtFileCleanup is the dispatch routine for IRP_MJ_CLEANUP. - Needs to close the FileObj and then cleanup (remove AL?) - -Arguments: - - -Return Value: - - ---*/ - -static VOID -Bus_EvtDeviceFileCleanup ( IN WDFFILEOBJECT FileObject ) -{ - PFDO_BUS_DATA fdoData; - - PAGED_CODE (); - KdPrint(("--> %s()\n",__FUNCTION__)); - - fdoData = FdoGetData(WdfFileObjectGetDevice(FileObject)); - - KdPrint(("<-- %s()\n",__FUNCTION__)); - - return; -} - - -/*++ - -Routine Description: - - EvtDeviceSelfManagedIoInit is called by the Framework when the device - enters the D0 state. Its job is to start any I/O-related actions that the - Framework isn't managing. This might include releasing queues that are not - power-managed, that is, the Framework is not automatically holding and - releasing them across PnP/Power transitions. (The default behavior for - WDFQUEUE is auto-managed, so most queues don't need to be dealt with here.) - This might also include setting up non-queue-based actions. - - If you allow the Framework to manage most or all of your queues, then when - you build a driver from this sample, you can probably delete this function. - - In this driver, the SelfManagedIo callbacks are used to implement a - watchdog timer. - - This function is not marked pagable because this function is in the - device power up path. When a function is marked pagable and the code - section is paged out, it will generate a page fault which could impact - the fast resume behavior because the client driver will have to wait - until the system drivers can service this page fault. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - NTSTATUS - Failures will result in the device stack being torn down. - ---*/ - -NTSTATUS -Bus_EvtDeviceSelfManagedIoInit( IN WDFDEVICE Device ) -{ - NTSTATUS status=STATUS_SUCCESS; - PFDO_BUS_DATA fdoData; - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s()\n", __FUNCTION__); - - fdoData = FdoGetData(Device); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, - "<-- %s() ret %x\n", __FUNCTION__, status); - - return status; -} - - -/*++ - -Routine Description: - - EvtDeviceSelfManagedIoSuspend is called by the Framework before the device - leaves the D0 state. Its job is to stop any I/O-related actions that the - Framework isn't managing, and which cannot be handled when the device - hardware isn't available. In general, this means reversing anything that - was done in EvtDeviceSelfManagedIoStart. - - If you allow the Framework to manage most or all of your queues, then when - you build a driver from this sample, you can probably delete this function. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - NTSTATUS - Failures will result in the device stack being torn down. - ---*/ - -NTSTATUS -Bus_EvtDeviceSelfManagedIoSuspend( IN WDFDEVICE Device ) -{ - PFDO_BUS_DATA fdoData; - - PAGED_CODE(); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s()\n", __FUNCTION__); - - fdoData = FdoGetData(Device); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s()\n", __FUNCTION__); - - return STATUS_SUCCESS; -} - - -/*++ - -Routine Description: - - EvtDeviceSelfManagedIoRestart is called by the Framework before the device - is restarted for one of the following reasons: - a) the PnP resources were rebalanced (framework received - query-stop and stop IRPS ) - b) the device resumed from a low power state to D0. - - This function is not marked pagable because this function is in the - device power up path. When a function is marked pagable and the code - section is paged out, it will generate a page fault which could impact - the fast resume behavior because the client driver will have to wait - until the system drivers can service this page fault. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - NTSTATUS - Failure will cause the device stack to be torn down. - ---*/ - -NTSTATUS -Bus_EvtDeviceSelfManagedIoRestart( IN WDFDEVICE Device ) -{ - PFDO_BUS_DATA fdoData; - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s()\n", __FUNCTION__); - - fdoData = FdoGetData(Device); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s()\n", __FUNCTION__); - - return STATUS_SUCCESS; -} - - -/*++ - -Routine Description: - - EvtDeviceSelfManagedIoCleanup is called by the Framework when the device is - being torn down, either in response to the WDM IRP_MN_REMOVE_DEVICE - It will be called only once. Its job is to stop all outstanding I/O in the driver - that the Framework is not managing. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - None - ---*/ - -VOID -Bus_EvtDeviceSelfManagedIoCleanup( IN WDFDEVICE Device ) -{ - PFDO_BUS_DATA fdoData; - - PAGED_CODE(); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "--> %s()\n",__FUNCTION__); - - fdoData = FdoGetData(Device); - - TraceEvents(TRACE_LEVEL_INFORMATION, DBG_PNP, "<-- %s()\n",__FUNCTION__); -} - - -/*++ - -Routine Description: - - EvtDeviceQueryStop event callback function determines whether a specified - device can be stopped so that the PnP manager can redistribute system - hardware resources. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - SUCCESS - OK to stop the device, otherwise NOT advisable to stop device. - ---*/ - -NTSTATUS -Bus_EvtDeviceQueryStop ( IN WDFDEVICE Device ) -{ - PFDO_BUS_DATA fdoData; - - BUS_ENTER( BUS_DBG_PNP ); - - fdoData = FdoGetData(Device); - // always OK to STOP the device. - - BUS_EXIT( BUS_DBG_PNP ); - - return STATUS_SUCCESS; -} - - -/*++ - -Routine Description: - - EvtDeviceQueryRemove event callback function determines whether a specified - device can be stopped and removed. - -Arguments: - - Device - Handle to a framework device object. - -Return Value: - - SUCCESS - OK to stop the device, otherwise NOT advisable to stop device. - ---*/ - - -NTSTATUS -Bus_EvtDeviceQueryRemove ( IN WDFDEVICE Device ) -{ - NTSTATUS status = STATUS_SUCCESS; - PFDO_BUS_DATA p_ext; - - BUS_ENTER( BUS_DBG_PNP ); - - p_ext = FdoGetData(Device); - - if ( p_ext->n_ci_ifc_ref ) - { - /* - * Our interface is still being held by someone. - * Fail the query. - */ - - BUS_TRACE_EXIT( BUS_DBG_PNP, - ("Failing IRP_MN_QUERY_REMOVE_DEVICE:\n" - "\tLowerInterface has %d references\n", - p_ext->n_ci_ifc_ref ) ); - status = STATUS_UNSUCCESSFUL; - } - - BUS_EXIT( BUS_DBG_PNP ); - - return status; -} - - -VOID -Bus_EvtDeviceSurpriseRemoval ( IN WDFDEVICE Device ) -{ - PFDO_BUS_DATA fdoData; - - BUS_ENTER( BUS_DBG_PNP ); - - fdoData = FdoGetData(Device); - - BUS_EXIT( BUS_DBG_PNP ); -} - - -VOID -Bus_EvtDeviceUsageNotify ( - IN WDFDEVICE Device, - IN WDF_SPECIAL_FILE_TYPE NotificationType, - IN BOOLEAN IsInNotificationPath ) -{ - PFDO_BUS_DATA fdoData; - UNREFERENCED_PARAMETER( NotificationType ); - UNREFERENCED_PARAMETER( IsInNotificationPath ); - - BUS_ENTER( BUS_DBG_PNP ); - - fdoData = FdoGetData(Device); - - BUS_EXIT( BUS_DBG_PNP ); -} - - /*++ Routine Description: @@ -3284,6 +2851,7 @@ fdo_query_remove_relations( } +#ifdef NOT_YET /* * WDFDEVICE object cleanup */ @@ -3296,4 +2864,4 @@ Bus_EvtDeviceObjContextCleanup ( IN WDFOBJECT Object ) BUS_EXIT( BUS_DBG_PNP ); } - +#endif -- 2.41.0