CPGPdiskInterface::~CPGPdiskInterface()
{
	if (mTimerStarted)
		IoStopTimer(m_pDeviceObject);

	DeleteSystemHooks();
}
예제 #2
0
파일: fdo.c 프로젝트: Moteesh/reactos
NTSTATUS
USBSTOR_FdoHandlePnp(
    IN PDEVICE_OBJECT DeviceObject,
    IN OUT PIRP Irp)
{
    PIO_STACK_LOCATION IoStack;
    PFDO_DEVICE_EXTENSION DeviceExtension;
    NTSTATUS Status;

    //
    // get current stack location
    //
    IoStack = IoGetCurrentIrpStackLocation(Irp);

    //
    // get device extension
    //
    DeviceExtension = (PFDO_DEVICE_EXTENSION)DeviceObject->DeviceExtension;

    //
    // sanity check
    //
    ASSERT(DeviceExtension->Common.IsFDO);

    switch(IoStack->MinorFunction)
    {
       case IRP_MN_SURPRISE_REMOVAL:
       {
           DPRINT("IRP_MN_SURPRISE_REMOVAL %p\n", DeviceObject);
           Irp->IoStatus.Status = STATUS_SUCCESS;

            //
            // forward irp to next device object
            //
            IoSkipCurrentIrpStackLocation(Irp);
            return IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
       }
       case IRP_MN_QUERY_DEVICE_RELATIONS:
       {
           DPRINT("IRP_MN_QUERY_DEVICE_RELATIONS %p\n", DeviceObject);
           Status = USBSTOR_FdoHandleDeviceRelations(DeviceExtension, Irp);
           break;
       }
       case IRP_MN_STOP_DEVICE:
       {
           DPRINT1("USBSTOR_FdoHandlePnp: IRP_MN_STOP_DEVICE unimplemented\n");
           IoStopTimer(DeviceObject);
           Irp->IoStatus.Status = STATUS_SUCCESS;

            //
            // forward irp to next device object
            //
            IoSkipCurrentIrpStackLocation(Irp);
            return IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
       }
       case IRP_MN_REMOVE_DEVICE:
       {
           DPRINT("IRP_MN_REMOVE_DEVICE\n");

           return USBSTOR_FdoHandleRemoveDevice(DeviceObject, DeviceExtension, Irp);
       }
       case IRP_MN_QUERY_CAPABILITIES:
       {
           //
           // FIXME: set custom capabilities
           //
           IoSkipCurrentIrpStackLocation(Irp);
           return IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
       }
       case IRP_MN_QUERY_STOP_DEVICE:
       case IRP_MN_QUERY_REMOVE_DEVICE:
       {
#if 0
           //
           // we can if nothing is pending
           //
           if (DeviceExtension->IrpPendingCount != 0 ||
               DeviceExtension->ActiveSrb != NULL)
#else
           if (TRUE)
#endif
           {
               /* We have pending requests */
               DPRINT1("Failing removal/stop request due to pending requests present\n");
               Status = STATUS_UNSUCCESSFUL;
           }
           else
           {
               /* We're all clear */
               Irp->IoStatus.Status = STATUS_SUCCESS;

               IoSkipCurrentIrpStackLocation(Irp);
               return IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
           }
           break;
       }
       case IRP_MN_START_DEVICE:
       {
           Status = USBSTOR_FdoHandleStartDevice(DeviceObject, DeviceExtension, Irp);
           break;
       }
       default:
        {
            //
            // forward irp to next device object
            //
            IoSkipCurrentIrpStackLocation(Irp);
            return IoCallDriver(DeviceExtension->LowerDeviceObject, Irp);
        }
    }

    //
    // complete request
    //
    if (Status != STATUS_PENDING)
    {
        //
        // store result
        //
        Irp->IoStatus.Status = Status;

        //
        // complete request
        //
        IoCompleteRequest(Irp, IO_NO_INCREMENT);
    }

    //
    // done processing
    //
    return Status;
}
예제 #3
0
VOID
SpReleaseAdapterResources(
    IN PADAPTER_EXTENSION Adapter,
    IN BOOLEAN Surprise
    )

/*++

Routine Description:

    This function deletes all of the storage associated with a device
    extension, disconnects from the timers and interrupts and then deletes the
    object.   This function can be called at any time during the initialization.

Arguments:

    Adapter - Supplies a pointer to the device extesnion to be deleted.

Return Value:

    None.

--*/

{

    PCOMMON_EXTENSION commonExtension = &(Adapter->CommonExtension);
    ULONG j;
    PVOID tempPointer;

    PAGED_CODE();

#if DBG

    if(!Surprise) {

        //
        // Free the Remove tracking lookaside list.
        //

        ExDeleteNPagedLookasideList(&(commonExtension->RemoveTrackingLookasideList));
    }
#endif

    //
    // Stop the time and disconnect the interrupt if they have been
    // initialized.  The interrupt object is connected after
    // timer has been initialized, and the interrupt object is connected, but
    // before the timer is started.
    //

    if(Adapter->DeviceObject->Timer != NULL) {
        IoStopTimer(Adapter->DeviceObject);
        KeCancelTimer(&(Adapter->MiniPortTimer));
    }

    if(Adapter->SynchronizeExecution != SpSynchronizeExecution) {

        if (Adapter->InterruptObject) {
            IoDisconnectInterrupt(Adapter->InterruptObject);
        }

        if (Adapter->InterruptObject2) {
            IoDisconnectInterrupt(Adapter->InterruptObject2);
            Adapter->InterruptObject2 = NULL;
        }

        //
        // SpSynchronizeExecution expects to get a pointer to the 
        // adapter extension as the "interrupt" parameter.
        //

        Adapter->InterruptObject = (PVOID) Adapter;
        Adapter->SynchronizeExecution = SpSynchronizeExecution;
    }

    //
    // Delete the miniport's device extension
    //

    if (Adapter->HwDeviceExtension != NULL) {

        PHW_DEVICE_EXTENSION devExt =
            CONTAINING_RECORD(Adapter->HwDeviceExtension,
                              HW_DEVICE_EXTENSION,
                              HwDeviceExtension);

        ExFreePool(devExt);
        Adapter->HwDeviceExtension = NULL;
    }

    //
    // Free the configuration information structure.
    //

    if (Adapter->PortConfig) {
        ExFreePool(Adapter->PortConfig);
        Adapter->PortConfig = NULL;
    }

    //
    // Deallocate SCSIPORT WMI REGINFO information, if any.
    //

    SpWmiDestroySpRegInfo(Adapter->DeviceObject);

    //
    // Free the common buffer.
    //

    if (Adapter->SrbExtensionBuffer != NULL &&
        Adapter->CommonBufferSize != 0) {

        if (Adapter->DmaAdapterObject == NULL) {

            //
            // Since there is no adapter just free the non-paged pool.
            //

            ExFreePool(Adapter->SrbExtensionBuffer);

        } else {

#if defined(_X86_)
            if(Adapter->UncachedExtensionIsCommonBuffer == FALSE) {
                MmFreeContiguousMemorySpecifyCache(Adapter->SrbExtensionBuffer,
                                                   Adapter->CommonBufferSize,
                                                   MmNonCached);
            } else 
#endif
            {

                HalFreeCommonBuffer(
                    Adapter->DmaAdapterObject,
                    Adapter->CommonBufferSize,
                    Adapter->PhysicalCommonBuffer,
                    Adapter->SrbExtensionBuffer,
                    FALSE);
            }

        }
        Adapter->SrbExtensionBuffer = NULL;
    }

    //
    // Free the SRB data array.
    //

    if (Adapter->SrbDataListInitialized) {

        if(Adapter->EmergencySrbData != NULL) {

            ExFreeToNPagedLookasideList(
                &Adapter->SrbDataLookasideList,
                Adapter->EmergencySrbData);
            Adapter->EmergencySrbData = NULL;
        }

        ExDeleteNPagedLookasideList(&Adapter->SrbDataLookasideList);

        Adapter->SrbDataListInitialized = FALSE;
    }

    if (Adapter->InquiryBuffer != NULL) {
        ExFreePool(Adapter->InquiryBuffer);
        Adapter->InquiryBuffer = NULL;
    }

    if (Adapter->InquirySenseBuffer != NULL) {
        ExFreePool(Adapter->InquirySenseBuffer);
        Adapter->InquirySenseBuffer = NULL;
    }

    if (Adapter->InquiryIrp != NULL) {
        IoFreeIrp(Adapter->InquiryIrp);
        Adapter->InquiryIrp = NULL;
    }

    if (Adapter->InquiryMdl != NULL) {
        IoFreeMdl(Adapter->InquiryMdl);
        Adapter->InquiryMdl = NULL;
    }

    //
    // Free the Scatter Gather lookaside list.
    //

    if (Adapter->MediumScatterGatherListInitialized) {

        ExDeleteNPagedLookasideList(
            &Adapter->MediumScatterGatherLookasideList);

        Adapter->MediumScatterGatherListInitialized = FALSE;
    }

    //
    // Unmap any mapped areas.
    //

    SpReleaseMappedAddresses(Adapter);

    //
    // If we've got any resource lists allocated still we should free them
    // now.
    //

    if(Adapter->AllocatedResources != NULL) {
        ExFreePool(Adapter->AllocatedResources);
        Adapter->AllocatedResources = NULL;
    }

    if(Adapter->TranslatedResources != NULL) {
        ExFreePool(Adapter->TranslatedResources);
        Adapter->TranslatedResources = NULL;
    }

    Adapter->CommonExtension.IsInitialized = FALSE;

    return;
}
예제 #4
0
파일: timer.c 프로젝트: GYGit/reactos
VOID NTAPI
VideoPortStopTimer(IN PVOID HwDeviceExtension)
{
   TRACE_(VIDEOPRT, "VideoPortStopTimer\n");
   IoStopTimer(VIDEO_PORT_GET_DEVICE_EXTENSION(HwDeviceExtension)->FunctionalDeviceObject);
}