win-pvdrivers

changeset 682:38fd04771db8

Allow inactive cdrom devices to be removed
author James Harper <james.harper@bendigoit.com.au>
date Sun Oct 11 00:20:16 2009 +1100 (2009-10-11)
parents 78bd7b215672
children 4baaaaa23235
files xenpci/xenpci_pdo.c
line diff
     1.1 --- a/xenpci/xenpci_pdo.c	Fri Oct 09 09:30:24 2009 +1100
     1.2 +++ b/xenpci/xenpci_pdo.c	Sun Oct 11 00:20:16 2009 +1100
     1.3 @@ -1164,7 +1164,6 @@ XenPci_UpdateBackendState(PVOID context)
     1.4    PXENPCI_PDO_DEVICE_DATA xppdd = GetXppdd(device);
     1.5    PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
     1.6    ULONG new_backend_state;
     1.7 -  CHAR tmp_path[128];
     1.8  
     1.9    FUNCTION_ENTER();
    1.10  
    1.11 @@ -1215,68 +1214,13 @@ XenPci_UpdateBackendState(PVOID context)
    1.12  
    1.13    case XenbusStateClosing:
    1.14      KdPrint((__DRIVER_NAME "     Backend State Changed to Closing\n"));
    1.15 -    if (xppdd->frontend_state == XenbusStateConnected)
    1.16 -    {
    1.17 -      KdPrint((__DRIVER_NAME "     Requesting eject\n"));
    1.18 -      WdfPdoRequestEject(device);
    1.19 -    }
    1.20 +    KdPrint((__DRIVER_NAME "     Requesting eject\n"));
    1.21 +    WdfPdoRequestEject(device);
    1.22      break;
    1.23  
    1.24    case XenbusStateClosed:
    1.25      KdPrint((__DRIVER_NAME "     Backend State Changed to Closed\n"));
    1.26      break;
    1.27 -
    1.28 -  case XenbusStateReconfiguring:
    1.29 -    KdPrint((__DRIVER_NAME "     Backend State Changed to Reconfiguring\n"));
    1.30 -    RtlStringCbPrintfA(tmp_path, ARRAY_SIZE(tmp_path), "%s/state", xppdd->path);
    1.31 -    KdPrint((__DRIVER_NAME "     Setting %s to %d\n", tmp_path, XenbusStateReconfiguring));
    1.32 -    XenBus_Printf(xpdd, XBT_NIL, tmp_path, "%d", XenbusStateReconfiguring);
    1.33 -    break;
    1.34 -
    1.35 -  case XenbusStateReconfigured:
    1.36 -    KdPrint((__DRIVER_NAME "     Backend State Changed to Reconfigured\n"));
    1.37 -  {
    1.38 -    PDEVICE_OBJECT fdo;
    1.39 -    PIRP irp;
    1.40 -    PIO_STACK_LOCATION stack;
    1.41 -    NTSTATUS status;
    1.42 -    KEVENT irp_complete_event;
    1.43 -    
    1.44 -    fdo = IoGetAttachedDeviceReference(WdfDeviceWdmGetDeviceObject(device));
    1.45 -    KeInitializeEvent(&irp_complete_event, NotificationEvent, FALSE);
    1.46 -    irp = IoAllocateIrp(fdo->StackSize, FALSE);
    1.47 -    stack = IoGetNextIrpStackLocation(irp);
    1.48 -    stack->MajorFunction = IRP_MJ_INTERNAL_DEVICE_CONTROL;
    1.49 -    stack->Parameters.DeviceIoControl.IoControlCode = (ULONG)IOCTL_XEN_RECONFIGURE;
    1.50 -    IoSetCompletionRoutine(irp, XenPciPdo_ReconfigureCompletionRoutine, &irp_complete_event, TRUE, TRUE, TRUE);
    1.51 -    status = IoCallDriver(fdo, irp);
    1.52 -    if (status == STATUS_PENDING)
    1.53 -    {
    1.54 -      KdPrint((__DRIVER_NAME "     Waiting for completion\n"));
    1.55 -      status = KeWaitForSingleObject(&irp_complete_event, Executive, KernelMode, FALSE, NULL);
    1.56 -      status = irp->IoStatus.Status;                     
    1.57 -    }
    1.58 -    KdPrint((__DRIVER_NAME "     IOCTL_XEN_RECONFIGURE status = %08x\n", status));
    1.59 -    ObDereferenceObject(fdo);
    1.60 -#if 0
    1.61 -    WDFREQUEST request;
    1.62 -    WDF_REQUEST_SEND_OPTIONS options;
    1.63 -    WDFIOTARGET target;
    1.64 -    DEVICE_OBJECT fdo;
    1.65 -    
    1.66 -    WDF_REQUEST_SEND_OPTIONS_INIT(&options, WDF_REQUEST_SEND_OPTION_SEND_AND_FORGET);
    1.67 -    fdo = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device));
    1.68 -    
    1.69 -    target = WdfDeviceGetIoTarget(xppdd->wdf_device);
    1.70 -    WdfRequestCreate(WDF_NO_OBJECT_ATTRIBUTES, target, &request);
    1.71 -    WdfIoTargetFormatRequestForInternalIoctl(target, request, IOCTL_XEN_RECONFIGURE, NULL, NULL, NULL, NULL);
    1.72 -    WdfRequestSend(request, target, &options);
    1.73 -#endif
    1.74 -    RtlStringCbPrintfA(tmp_path, ARRAY_SIZE(tmp_path), "%s/state", xppdd->path);
    1.75 -    KdPrint((__DRIVER_NAME "     Setting %s to %d\n", tmp_path, XenbusStateConnected));
    1.76 -    XenBus_Printf(xpdd, XBT_NIL, tmp_path, "%d", XenbusStateConnected);
    1.77 -    break;
    1.78 -  }
    1.79    
    1.80    default:
    1.81      KdPrint((__DRIVER_NAME "     Backend State Changed to Undefined = %d\n", xppdd->backend_state));