win-pvdrivers

changeset 289:691c6ebe92cf wdm

Started adding code to cope with 'xm block-detach'. currently BSoD's.
author James Harper <james.harper@bendigoit.com.au>
date Tue Jun 03 22:39:32 2008 +1000 (2008-06-03)
parents 812a4b0f9460
children a5d5a0376f96
files common.inc installer.nsi xenhide/xenhide.c xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c xenstub/xenstub.c xenstub/xenstub.inx xenvbd/scsiport.c
line diff
     1.1 --- a/common.inc	Mon Jun 02 11:58:26 2008 +1000
     1.2 +++ b/common.inc	Tue Jun 03 22:39:32 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.5.0
     1.5 +VERSION=0.9.6.1
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/installer.nsi	Mon Jun 02 11:58:26 2008 +1000
     2.2 +++ b/installer.nsi	Tue Jun 03 22:39:32 2008 +1000
     2.3 @@ -3,7 +3,7 @@
     2.4  
     2.5  !define AppName "Xen PV Drivers"
     2.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     2.7 -!define Version "0.9.5"
     2.8 +!define Version "0.9.6"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
     3.1 --- a/xenhide/xenhide.c	Mon Jun 02 11:58:26 2008 +1000
     3.2 +++ b/xenhide/xenhide.c	Tue Jun 03 22:39:32 2008 +1000
     3.3 @@ -59,7 +59,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
     3.4    UNREFERENCED_PARAMETER(RegistryPath);
     3.5  
     3.6    KdPrint((__DRIVER_NAME " --> DriverEntry\n"));
     3.7 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
     3.8  
     3.9    RtlInitUnicodeString(&RegKeyName, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
    3.10    InitializeObjectAttributes(&RegObjectAttributes, &RegKeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);
    3.11 @@ -164,36 +163,36 @@ XenHide_AddDevice(
    3.12  //  PWCHAR Ptr;
    3.13    GUID bus_type;
    3.14  
    3.15 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.16 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.17  
    3.18    length = 256;
    3.19    status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyDeviceDescription, length, buffer, &length);
    3.20 -  if (!NT_SUCCESS(status))
    3.21 -    KdPrint((__DRIVER_NAME "     (failed to get DevicePropertyDeviceDescription %08x)\n", status));
    3.22 -  else
    3.23 -    KdPrint((__DRIVER_NAME "     Description = %S\n", buffer));
    3.24 +//  if (!NT_SUCCESS(status))
    3.25 +//    KdPrint((__DRIVER_NAME "     (failed to get DevicePropertyDeviceDescription %08x)\n", status));
    3.26 +//  else
    3.27 +//    KdPrint((__DRIVER_NAME "     Description = %S\n", buffer));
    3.28  
    3.29    length = sizeof(GUID);
    3.30    status = IoGetDeviceProperty(PhysicalDeviceObject, DevicePropertyBusTypeGuid, length, &bus_type, &length);
    3.31    if (!NT_SUCCESS(status))
    3.32    {
    3.33 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (failed to get DevicePropertyBusTypeGuid %08x)\n", status));
    3.34 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (failed to get DevicePropertyBusTypeGuid %08x)\n", status));
    3.35      return STATUS_SUCCESS;
    3.36    }
    3.37  
    3.38    if (!gplpv && memcmp(&bus_type, &GUID_BUS_TYPE_XEN, sizeof(GUID)) != 0)
    3.39    {
    3.40 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == FALSE && bus_type != GUID_BUS_TYPE_XEN)\n"));
    3.41 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == FALSE && bus_type != GUID_BUS_TYPE_XEN)\n"));
    3.42      return STATUS_SUCCESS;
    3.43    }
    3.44    
    3.45    if (gplpv && memcmp(&bus_type, &GUID_BUS_TYPE_PCI, sizeof(GUID)) != 0)
    3.46    {
    3.47 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == TRUE && bus_type != GUID_BUS_TYPE_PCI)\n"));
    3.48 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (gplpv == TRUE && bus_type != GUID_BUS_TYPE_PCI)\n"));
    3.49      return STATUS_SUCCESS;
    3.50    }
    3.51  
    3.52 -  KdPrint((__DRIVER_NAME "     Installing Filter\n"));
    3.53 +//  KdPrint((__DRIVER_NAME "     Installing Filter\n"));
    3.54  
    3.55    status = IoCreateDevice (DriverObject,
    3.56      sizeof(XENHIDE_DEVICE_DATA),
    3.57 @@ -218,7 +217,7 @@ XenHide_AddDevice(
    3.58  
    3.59    deviceObject->Flags &= ~DO_DEVICE_INITIALIZING;
    3.60  
    3.61 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.62 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.63  
    3.64    return STATUS_SUCCESS;
    3.65  }
    3.66 @@ -241,14 +240,14 @@ XenHide_Pnp_IoCompletion(PDEVICE_OBJECT 
    3.67  
    3.68    UNREFERENCED_PARAMETER(device_object);
    3.69  
    3.70 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.71 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.72  
    3.73    if (irp->PendingReturned)
    3.74    {
    3.75      KeSetEvent(event, IO_NO_INCREMENT, FALSE);
    3.76    }
    3.77  
    3.78 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    3.79 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    3.80  
    3.81    return STATUS_MORE_PROCESSING_REQUIRED;
    3.82  }
    3.83 @@ -262,7 +261,7 @@ XenHide_SendAndWaitForIrp(PDEVICE_OBJECT
    3.84  
    3.85    UNREFERENCED_PARAMETER(device_object);
    3.86  
    3.87 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.88 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.89  
    3.90    KeInitializeEvent(&event, NotificationEvent, FALSE);
    3.91  
    3.92 @@ -273,13 +272,13 @@ XenHide_SendAndWaitForIrp(PDEVICE_OBJECT
    3.93  
    3.94    if (status == STATUS_PENDING)
    3.95    {
    3.96 -    KdPrint((__DRIVER_NAME "     waiting ...\n"));
    3.97 +//    KdPrint((__DRIVER_NAME "     waiting ...\n"));
    3.98      KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
    3.99 -    KdPrint((__DRIVER_NAME "     ... done\n"));
   3.100 +//    KdPrint((__DRIVER_NAME "     ... done\n"));
   3.101      status = irp->IoStatus.Status;
   3.102    }
   3.103  
   3.104 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   3.105 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   3.106  
   3.107    return status;
   3.108  }
   3.109 @@ -291,8 +290,7 @@ XenHide_Pnp(PDEVICE_OBJECT device_object
   3.110    PIO_STACK_LOCATION stack;
   3.111    PXENHIDE_DEVICE_DATA xhdd = (PXENHIDE_DEVICE_DATA)device_object->DeviceExtension;
   3.112  
   3.113 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   3.114 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   3.115 +//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   3.116  
   3.117    stack = IoGetCurrentIrpStackLocation(irp);
   3.118  
   3.119 @@ -302,12 +300,12 @@ XenHide_Pnp(PDEVICE_OBJECT device_object
   3.120      IoCompleteRequest(irp, IO_NO_INCREMENT);
   3.121      break;
   3.122    case IRP_MN_QUERY_CAPABILITIES:
   3.123 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_CAPABILITIES\n"));
   3.124 +//    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_CAPABILITIES\n"));
   3.125      stack->Parameters.DeviceCapabilities.Capabilities->NoDisplayInUI = 1;
   3.126      status = XenHide_SendAndWaitForIrp(device_object, irp);
   3.127      status = irp->IoStatus.Status = STATUS_SUCCESS;
   3.128      IoCompleteRequest(irp, IO_NO_INCREMENT);
   3.129 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   3.130 +//    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   3.131      return status;
   3.132    default:
   3.133      IoSkipCurrentIrpStackLocation(irp);
   3.134 @@ -315,7 +313,7 @@ XenHide_Pnp(PDEVICE_OBJECT device_object
   3.135      break;
   3.136    }
   3.137  
   3.138 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returning with status %08x)\n", status));
   3.139 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ " (returning with status %08x)\n", status));
   3.140  
   3.141    return status;
   3.142  }
     4.1 --- a/xenpci/xenpci_fdo.c	Mon Jun 02 11:58:26 2008 +1000
     4.2 +++ b/xenpci/xenpci_fdo.c	Tue Jun 03 22:39:32 2008 +1000
     4.3 @@ -831,6 +831,16 @@ XenPci_Pnp_QueryBusRelationsCallback(PDE
     4.4      }
     4.5      dev_relations->Count = device_count;
     4.6  
     4.7 +    for (child = (PXEN_CHILD)xpdd->child_list.Flink; child != (PXEN_CHILD)&xpdd->child_list; child = (PXEN_CHILD)child->entry.Flink)
     4.8 +    {
     4.9 +      if (child->state == CHILD_STATE_DELETED)
    4.10 +      {
    4.11 +        KdPrint((__DRIVER_NAME "     Removing deleted child from device list\n" ));
    4.12 +        child->entry.Flink;
    4.13 +        ExFreePoolWithTag(child->entry.Blink, XENPCI_POOL_TAG);
    4.14 +      }
    4.15 +    }
    4.16 +    
    4.17      status = STATUS_SUCCESS;
    4.18    }
    4.19    else
    4.20 @@ -936,7 +946,8 @@ XenPci_Pnp_DeviceUsageNotification(PDEVI
    4.21    xpdd = (PXENPCI_DEVICE_DATA)device_object->DeviceExtension;
    4.22    stack = IoGetCurrentIrpStackLocation(irp);
    4.23    status = irp->IoStatus.Status;
    4.24 -  
    4.25 +
    4.26 +  /* fail if we are in a stop or remove pending state */  
    4.27    if (!NT_SUCCESS(irp->IoStatus.Status))
    4.28    {
    4.29      switch (stack->Parameters.UsageNotification.Type)
     5.1 --- a/xenpci/xenpci_pdo.c	Mon Jun 02 11:58:26 2008 +1000
     5.2 +++ b/xenpci/xenpci_pdo.c	Tue Jun 03 22:39:32 2008 +1000
     5.3 @@ -36,7 +36,7 @@ XenPci_Power_Pdo(PDEVICE_OBJECT device_o
     5.4  
     5.5    UNREFERENCED_PARAMETER(device_object);
     5.6    
     5.7 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     5.8 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     5.9  
    5.10    stack = IoGetCurrentIrpStackLocation(irp);
    5.11    power_type = stack->Parameters.Power.Type;
    5.12 @@ -45,15 +45,15 @@ XenPci_Power_Pdo(PDEVICE_OBJECT device_o
    5.13    switch (stack->MinorFunction)
    5.14    {
    5.15    case IRP_MN_POWER_SEQUENCE:
    5.16 -    KdPrint((__DRIVER_NAME "     IRP_MN_POWER_SEQUENCE\n"));
    5.17 +    //KdPrint((__DRIVER_NAME "     IRP_MN_POWER_SEQUENCE\n"));
    5.18      status = STATUS_NOT_SUPPORTED;
    5.19      break;
    5.20    case IRP_MN_QUERY_POWER:
    5.21 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_POWER\n"));
    5.22 +    //KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_POWER\n"));
    5.23      status = STATUS_SUCCESS;
    5.24      break;
    5.25    case IRP_MN_SET_POWER:
    5.26 -    KdPrint((__DRIVER_NAME "     IRP_MN_SET_POWER\n"));
    5.27 +    //KdPrint((__DRIVER_NAME "     IRP_MN_SET_POWER\n"));
    5.28      switch (power_type) {
    5.29      case DevicePowerState:
    5.30        PoSetPowerState(device_object, power_type, power_state);
    5.31 @@ -68,7 +68,7 @@ XenPci_Power_Pdo(PDEVICE_OBJECT device_o
    5.32      }    
    5.33      break;
    5.34    case IRP_MN_WAIT_WAKE:
    5.35 -    KdPrint((__DRIVER_NAME "     IRP_MN_WAIT_WAKE\n"));
    5.36 +    //KdPrint((__DRIVER_NAME "     IRP_MN_WAIT_WAKE\n"));
    5.37      status = STATUS_NOT_SUPPORTED;
    5.38      break;
    5.39    default:
    5.40 @@ -84,7 +84,7 @@ XenPci_Power_Pdo(PDEVICE_OBJECT device_o
    5.41    status = irp->IoStatus.Status;
    5.42    IoCompleteRequest(irp, IO_NO_INCREMENT);
    5.43    
    5.44 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.45 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.46  
    5.47    return status;
    5.48  }
    5.49 @@ -115,7 +115,7 @@ XenPci_BackEndStateHandler(char *Path, P
    5.50    if (xppdd->backend_state == new_backend_state)
    5.51    {
    5.52      KdPrint((__DRIVER_NAME "     state unchanged\n"));
    5.53 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.54 +    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    5.55      return;
    5.56    }    
    5.57  
    5.58 @@ -144,8 +144,27 @@ XenPci_BackEndStateHandler(char *Path, P
    5.59      break;
    5.60  
    5.61    case XenbusStateClosing:
    5.62 -    KdPrint((__DRIVER_NAME "     Backend State Changed to Closing\n"));  
    5.63 -    /* check our current PNP statue - this may be a surprise removal... */
    5.64 +    KdPrint((__DRIVER_NAME "     Backend State Changed to Closing\n"));
    5.65 +    if (xppdd->common.device_usage_paging
    5.66 +      || xppdd->common.device_usage_dump
    5.67 +      || xppdd->common.device_usage_hibernation)
    5.68 +    {
    5.69 +      KdPrint((__DRIVER_NAME "     Not closing device because it is in use\n"));
    5.70 +      /* in use by page file, dump file, or hiber file - can't close */
    5.71 +      /* we should probably re-check if the device usage changes in the future */
    5.72 +    }
    5.73 +    else
    5.74 +    {
    5.75 +      if (xppdd->common.current_pnp_state == Started)
    5.76 +      {
    5.77 +        KdPrint((__DRIVER_NAME "     Sending RequestDeviceEject\n"));
    5.78 +        IoRequestDeviceEject(xppdd->common.pdo);
    5.79 +      }
    5.80 +      else
    5.81 +      {
    5.82 +        KdPrint((__DRIVER_NAME "     Not closing device because it is not started\n"));
    5.83 +      }
    5.84 +    }
    5.85      break;
    5.86  
    5.87    case XenbusStateClosed:
    5.88 @@ -335,12 +354,18 @@ XenPci_ShutdownDevice(PVOID Context)
    5.89    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    5.90  
    5.91    if (xppdd->backend_state == XenbusStateConnected)
    5.92 +  {
    5.93      XenPci_ChangeFrontendState(xppdd, XenbusStateClosing, XenbusStateClosing, 30000);
    5.94 -  if (xppdd->backend_state == XenbusStateClosing)
    5.95 -    XenPci_ChangeFrontendState(xppdd, XenbusStateClosed, XenbusStateClosed, 30000);
    5.96 -  if (xppdd->backend_state == XenbusStateClosed)
    5.97 -    XenPci_ChangeFrontendState(xppdd, XenbusStateInitialising, XenbusStateInitWait, 30000);
    5.98 -    
    5.99 +    if (xppdd->backend_state == XenbusStateClosing)
   5.100 +      XenPci_ChangeFrontendState(xppdd, XenbusStateClosed, XenbusStateClosed, 30000);
   5.101 +    if (xppdd->backend_state == XenbusStateClosed)
   5.102 +      XenPci_ChangeFrontendState(xppdd, XenbusStateInitialising, XenbusStateInitWait, 30000);
   5.103 +  }
   5.104 +  else
   5.105 +  {
   5.106 +    if (xppdd->backend_state == XenbusStateClosing)
   5.107 +      XenPci_ChangeFrontendState(xppdd, XenbusStateClosed, XenbusStateClosed, 30000);
   5.108 +  }
   5.109    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.110  
   5.111    return STATUS_SUCCESS;
   5.112 @@ -654,7 +679,7 @@ XenPci_QueryResourceRequirements(PDEVICE
   5.113    ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
   5.114    ird->Option = 0;
   5.115    ird->Type = CmResourceTypeInterrupt;
   5.116 -  ird->ShareDisposition = CmResourceShareShared; //CmResourceShareDeviceExclusive;
   5.117 +  ird->ShareDisposition = CmResourceShareShared;
   5.118    ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
   5.119    ird->u.Interrupt.MinimumVector = 1;
   5.120    ird->u.Interrupt.MaximumVector = 6;
   5.121 @@ -662,7 +687,7 @@ XenPci_QueryResourceRequirements(PDEVICE
   5.122    ird = &irrl->List[0].Descriptors[irrl->List[0].Count++];
   5.123    ird->Option = IO_RESOURCE_ALTERNATIVE;
   5.124    ird->Type = CmResourceTypeInterrupt;
   5.125 -  ird->ShareDisposition = CmResourceShareShared; //CmResourceShareDeviceExclusive;
   5.126 +  ird->ShareDisposition = CmResourceShareShared;
   5.127    ird->Flags = CM_RESOURCE_INTERRUPT_LEVEL_SENSITIVE;
   5.128    ird->u.Interrupt.MinimumVector = 10;
   5.129    ird->u.Interrupt.MaximumVector = 14;
   5.130 @@ -697,13 +722,13 @@ XenPci_Pnp_QueryCapabilities(PDEVICE_OBJ
   5.131    stack = IoGetCurrentIrpStackLocation(irp);
   5.132    dc = stack->Parameters.DeviceCapabilities.Capabilities;
   5.133    dc->LockSupported = FALSE;
   5.134 -  dc->EjectSupported = FALSE;
   5.135 -  dc->Removable = FALSE;
   5.136 +  dc->EjectSupported = FALSE; //TRUE;
   5.137 +  dc->Removable = TRUE;
   5.138    dc->DockDevice = FALSE;
   5.139    dc->UniqueID = FALSE;
   5.140 -  dc->SilentInstall = FALSE;
   5.141 +  dc->SilentInstall = TRUE; //FALSE;
   5.142    dc->RawDeviceOK = FALSE;
   5.143 -  dc->SurpriseRemovalOK = FALSE;
   5.144 +  dc->SurpriseRemovalOK = TRUE;
   5.145    dc->HardwareDisabled = FALSE;
   5.146    dc->NoDisplayInUI = FALSE;
   5.147    dc->DeviceWake = PowerDeviceUnspecified;
   5.148 @@ -730,6 +755,7 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
   5.149    WCHAR widebuf[256];
   5.150    unsigned int i;
   5.151    PPNP_BUS_INFORMATION pbi;
   5.152 +  ULONG *usage_type;
   5.153  
   5.154    KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   5.155  
   5.156 @@ -785,19 +811,31 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
   5.157  
   5.158    case IRP_MN_DEVICE_USAGE_NOTIFICATION:
   5.159      KdPrint((__DRIVER_NAME "     IRP_MN_DEVICE_USAGE_NOTIFICATION (status = %08x)\n", irp->IoStatus.Status));
   5.160 +    
   5.161 +    usage_type = NULL;
   5.162      switch (stack->Parameters.UsageNotification.Type)
   5.163      {
   5.164      case DeviceUsageTypePaging:
   5.165        KdPrint((__DRIVER_NAME "     type = DeviceUsageTypePaging\n"));
   5.166 +      usage_type = &xppdd->common.device_usage_paging;
   5.167        break;
   5.168      case DeviceUsageTypeDumpFile:
   5.169        KdPrint((__DRIVER_NAME "     type = DeviceUsageTypeDumpFile\n"));
   5.170 +      usage_type = &xppdd->common.device_usage_dump;
   5.171        break;
   5.172      case DeviceUsageTypeHibernation:
   5.173        KdPrint((__DRIVER_NAME "     type = DeviceUsageTypeHibernation\n"));
   5.174 +      usage_type = &xppdd->common.device_usage_hibernation;
   5.175        break;
   5.176      }
   5.177      KdPrint((__DRIVER_NAME "     inpath = %d\n", stack->Parameters.UsageNotification.InPath));
   5.178 +    if (usage_type)
   5.179 +    {
   5.180 +      if (stack->Parameters.UsageNotification.InPath)
   5.181 +        (*usage_type)++;
   5.182 +      else
   5.183 +        (*usage_type)--;
   5.184 +    }        
   5.185      status = STATUS_SUCCESS;
   5.186      break;
   5.187  
     6.1 --- a/xenstub/xenstub.c	Mon Jun 02 11:58:26 2008 +1000
     6.2 +++ b/xenstub/xenstub.c	Tue Jun 03 22:39:32 2008 +1000
     6.3 @@ -29,14 +29,14 @@ XenStub_Pnp_IoCompletion(PDEVICE_OBJECT 
     6.4  
     6.5    UNREFERENCED_PARAMETER(device_object);
     6.6  
     6.7 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     6.8 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
     6.9  
    6.10    if (irp->PendingReturned)
    6.11    {
    6.12      KeSetEvent(event, IO_NO_INCREMENT, FALSE);
    6.13    }
    6.14  
    6.15 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.16 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.17  
    6.18    return STATUS_MORE_PROCESSING_REQUIRED;
    6.19  }
    6.20 @@ -64,7 +64,7 @@ XenStub_SendAndWaitForIrp(PDEVICE_OBJECT
    6.21  
    6.22    UNREFERENCED_PARAMETER(device_object);
    6.23  
    6.24 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    6.25 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    6.26  
    6.27    KeInitializeEvent(&event, NotificationEvent, FALSE);
    6.28  
    6.29 @@ -75,13 +75,13 @@ XenStub_SendAndWaitForIrp(PDEVICE_OBJECT
    6.30  
    6.31    if (status == STATUS_PENDING)
    6.32    {
    6.33 -    KdPrint((__DRIVER_NAME "     waiting ...\n"));
    6.34 +    //KdPrint((__DRIVER_NAME "     waiting ...\n"));
    6.35      KeWaitForSingleObject(&event, Executive, KernelMode, FALSE, NULL);
    6.36 -    KdPrint((__DRIVER_NAME "     ... done\n"));
    6.37 +    //KdPrint((__DRIVER_NAME "     ... done\n"));
    6.38      status = irp->IoStatus.Status;
    6.39    }
    6.40  
    6.41 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.42 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.43  
    6.44    return status;
    6.45  }
    6.46 @@ -93,7 +93,7 @@ XenStub_Irp_Pnp(PDEVICE_OBJECT device_ob
    6.47    NTSTATUS status;
    6.48    PXENSTUB_DEVICE_DATA xsdd;
    6.49  
    6.50 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    6.51 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    6.52  
    6.53    xsdd = (PXENSTUB_DEVICE_DATA)device_object->DeviceExtension;
    6.54  
    6.55 @@ -102,93 +102,94 @@ XenStub_Irp_Pnp(PDEVICE_OBJECT device_ob
    6.56    switch (stack->MinorFunction)
    6.57    {
    6.58    case IRP_MN_START_DEVICE:
    6.59 -    KdPrint((__DRIVER_NAME "     IRP_MN_START_DEVICE\n"));
    6.60 +    //KdPrint((__DRIVER_NAME "     IRP_MN_START_DEVICE\n"));
    6.61      IoMarkIrpPending(irp);
    6.62      status = XenStub_SendAndWaitForIrp(device_object, irp);
    6.63      status = irp->IoStatus.Status = STATUS_SUCCESS;
    6.64      IoCompleteRequest(irp, IO_NO_INCREMENT);
    6.65 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.66 +    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
    6.67      return status;
    6.68  
    6.69    case IRP_MN_QUERY_STOP_DEVICE:
    6.70 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_STOP_DEVICE\n"));
    6.71 +    //KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_STOP_DEVICE\n"));
    6.72      IoSkipCurrentIrpStackLocation(irp);
    6.73      irp->IoStatus.Status = STATUS_SUCCESS;
    6.74      break;
    6.75  
    6.76    case IRP_MN_STOP_DEVICE:
    6.77 -    KdPrint((__DRIVER_NAME "     IRP_MN_STOP_DEVICE\n"));
    6.78 +    //KdPrint((__DRIVER_NAME "     IRP_MN_STOP_DEVICE\n"));
    6.79      IoSkipCurrentIrpStackLocation(irp);
    6.80      irp->IoStatus.Status = STATUS_SUCCESS;
    6.81      break;
    6.82  
    6.83    case IRP_MN_CANCEL_STOP_DEVICE:
    6.84 -    KdPrint((__DRIVER_NAME "     IRP_MN_CANCEL_STOP_DEVICE\n"));
    6.85 +    //KdPrint((__DRIVER_NAME "     IRP_MN_CANCEL_STOP_DEVICE\n"));
    6.86      IoSkipCurrentIrpStackLocation(irp);
    6.87      irp->IoStatus.Status = STATUS_SUCCESS;
    6.88      break;
    6.89  
    6.90    case IRP_MN_QUERY_REMOVE_DEVICE:
    6.91 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_REMOVE_DEVICE\n"));
    6.92 +    //KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_REMOVE_DEVICE\n"));
    6.93      IoSkipCurrentIrpStackLocation(irp);
    6.94      irp->IoStatus.Status = STATUS_SUCCESS;
    6.95      break;
    6.96      
    6.97    case IRP_MN_REMOVE_DEVICE:
    6.98 -    KdPrint((__DRIVER_NAME "     IRP_MN_REMOVE_DEVICE\n"));
    6.99 +    //KdPrint((__DRIVER_NAME "     IRP_MN_REMOVE_DEVICE\n"));
   6.100      IoSkipCurrentIrpStackLocation(irp);
   6.101      irp->IoStatus.Status = STATUS_SUCCESS;
   6.102      break;
   6.103  
   6.104    case IRP_MN_CANCEL_REMOVE_DEVICE:
   6.105 -    KdPrint((__DRIVER_NAME "     IRP_MN_CANCEL_REMOVE_DEVICE\n"));
   6.106 +    //KdPrint((__DRIVER_NAME "     IRP_MN_CANCEL_REMOVE_DEVICE\n"));
   6.107      IoSkipCurrentIrpStackLocation(irp);
   6.108      //irp->IoStatus.Status = STATUS_SUCCESS;
   6.109      break;
   6.110  
   6.111    case IRP_MN_SURPRISE_REMOVAL:
   6.112 -    KdPrint((__DRIVER_NAME "     IRP_MN_SURPRISE_REMOVAL\n"));
   6.113 +    //KdPrint((__DRIVER_NAME "     IRP_MN_SURPRISE_REMOVAL\n"));
   6.114      IoSkipCurrentIrpStackLocation(irp);
   6.115      //irp->IoStatus.Status = STATUS_SUCCESS;
   6.116      break;
   6.117  
   6.118    case IRP_MN_DEVICE_USAGE_NOTIFICATION:
   6.119 -    KdPrint((__DRIVER_NAME "     IRP_MN_DEVICE_USAGE_NOTIFICATION\n"));
   6.120 +    //KdPrint((__DRIVER_NAME "     IRP_MN_DEVICE_USAGE_NOTIFICATION\n"));
   6.121      IoSkipCurrentIrpStackLocation(irp);
   6.122      irp->IoStatus.Status = STATUS_SUCCESS;
   6.123      break;
   6.124  
   6.125    case IRP_MN_QUERY_DEVICE_RELATIONS:
   6.126 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_DEVICE_RELATIONS\n"));
   6.127 +    //KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_DEVICE_RELATIONS\n"));
   6.128      IoSkipCurrentIrpStackLocation(irp);
   6.129      //irp->IoStatus.Information = 0;
   6.130      //irp->IoStatus.Status = STATUS_SUCCESS;
   6.131      break;
   6.132  
   6.133    case IRP_MN_FILTER_RESOURCE_REQUIREMENTS:
   6.134 -    KdPrint((__DRIVER_NAME "     IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"));
   6.135 +    /* we actually want to do this - no need for interrupt here */
   6.136 +    //KdPrint((__DRIVER_NAME "     IRP_MN_FILTER_RESOURCE_REQUIREMENTS\n"));
   6.137      IoSkipCurrentIrpStackLocation(irp);
   6.138      //irp->IoStatus.Status = STATUS_SUCCESS;
   6.139      break;
   6.140  
   6.141    case IRP_MN_QUERY_PNP_DEVICE_STATE:
   6.142 -    KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_PNP_DEVICE_STATE\n"));
   6.143 +    //KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_PNP_DEVICE_STATE\n"));
   6.144      status = XenStub_SendAndWaitForIrp(device_object, irp);
   6.145      irp->IoStatus.Information |= PNP_DEVICE_DONT_DISPLAY_IN_UI;
   6.146      status = irp->IoStatus.Status = STATUS_SUCCESS;
   6.147      IoCompleteRequest(irp, IO_NO_INCREMENT);
   6.148 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.149 +    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.150      return status;
   6.151  
   6.152    default:
   6.153 -    KdPrint((__DRIVER_NAME "     Unhandled Minor = %d\n", stack->MinorFunction));
   6.154 +    //KdPrint((__DRIVER_NAME "     Unhandled Minor = %d\n", stack->MinorFunction));
   6.155      IoSkipCurrentIrpStackLocation(irp);
   6.156      break;
   6.157    }
   6.158  
   6.159    status = IoCallDriver(xsdd->lower_do, irp);
   6.160  
   6.161 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.162 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.163  
   6.164    return status;
   6.165  }
   6.166 @@ -201,14 +202,14 @@ XenStub_Irp_Power(PDEVICE_OBJECT device_
   6.167  
   6.168    UNREFERENCED_PARAMETER(device_object);
   6.169    
   6.170 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.171 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.172  
   6.173    PoStartNextPowerIrp(irp);
   6.174    IoSkipCurrentIrpStackLocation(irp);
   6.175  
   6.176    status =  PoCallDriver (xsdd->lower_do, irp);
   6.177    
   6.178 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   6.179 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   6.180  
   6.181    return status;
   6.182  }
   6.183 @@ -220,7 +221,7 @@ XenStub_AddDevice(PDRIVER_OBJECT DriverO
   6.184    PDEVICE_OBJECT fdo = NULL;
   6.185    PXENSTUB_DEVICE_DATA xsdd;
   6.186  
   6.187 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.188 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.189  
   6.190    status = IoCreateDevice(DriverObject,
   6.191      sizeof(XENSTUB_DEVICE_DATA),
   6.192 @@ -232,7 +233,7 @@ XenStub_AddDevice(PDRIVER_OBJECT DriverO
   6.193  
   6.194    if (!NT_SUCCESS(status))
   6.195    {
   6.196 -    KdPrint((__DRIVER_NAME "     IoCreateDevice failed 0x%08x\n", status));
   6.197 +    //KdPrint((__DRIVER_NAME "     IoCreateDevice failed 0x%08x\n", status));
   6.198      return status;
   6.199    }
   6.200  
   6.201 @@ -250,7 +251,7 @@ XenStub_AddDevice(PDRIVER_OBJECT DriverO
   6.202    
   6.203    fdo->Flags &= ~DO_DEVICE_INITIALIZING;
   6.204  
   6.205 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.206 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__"\n"));
   6.207    return status;
   6.208  }
   6.209  
   6.210 @@ -261,7 +262,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   6.211  
   6.212    UNREFERENCED_PARAMETER(RegistryPath);
   6.213  
   6.214 -  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.215 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   6.216  
   6.217    DriverObject->DriverExtension->AddDevice = XenStub_AddDevice;
   6.218    DriverObject->MajorFunction[IRP_MJ_PNP] = XenStub_Irp_Pnp;
   6.219 @@ -274,7 +275,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   6.220    DriverObject->MajorFunction[IRP_MJ_WRITE] = NULL;
   6.221    DriverObject->MajorFunction[IRP_MJ_SYSTEM_CONTROL] = NULL;
   6.222  
   6.223 -  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   6.224 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   6.225  
   6.226    return status;
   6.227  }
   6.228 \ No newline at end of file
     7.1 --- a/xenstub/xenstub.inx	Mon Jun 02 11:58:26 2008 +1000
     7.2 +++ b/xenstub/xenstub.inx	Tue Jun 03 22:39:32 2008 +1000
     7.3 @@ -16,14 +16,14 @@ ExcludeFromSelect=*
     7.4  %XenGplPv%=XenGplPv,NTamd64
     7.5  
     7.6  [XenGplPv.NTx86]
     7.7 -%XenStub.DRVDESC%=XenStub_Inst, XEN\CONSOLE
     7.8 -%XenStub.DRVDESC%=XenStub_Inst, XEN\VFB
     7.9 -%XenStub.DRVDESC%=XenStub_Inst, XEN\VKBD
    7.10 +%XenStub.DRVDESC.CONSOLE%=XenStub_Inst, XEN\CONSOLE
    7.11 +%XenStub.DRVDESC.VFB%=XenStub_Inst, XEN\VFB
    7.12 +%XenStub.DRVDESC.VKBD%=XenStub_Inst, XEN\VKBD
    7.13  
    7.14  [XenGplPv.NTamd64]
    7.15 -%XenStub.DRVDESC%=XenStub_Inst, XEN\CONSOLE
    7.16 -%XenStub.DRVDESC%=XenStub_Inst, XEN\VFB
    7.17 -%XenStub.DRVDESC%=XenStub_Inst, XEN\VKBD
    7.18 +%XenStub.DRVDESC.CONSOLE%=XenStub_Inst, XEN\CONSOLE
    7.19 +%XenStub.DRVDESC.VFB%=XenStub_Inst, XEN\VFB
    7.20 +%XenStub.DRVDESC.VKBD%=XenStub_Inst, XEN\VKBD
    7.21  
    7.22  [XenStub_Inst.NT]
    7.23  CopyFiles=XenStub.CopyFiles
    7.24 @@ -62,4 +62,7 @@ HKR,"Parameters\PnpInterface", "0", 0x00
    7.25  XenGplPv = "Xen GPL PV Driver Developers"
    7.26  XenStub.SVCDESC = "Xen Stub Device Driver"
    7.27  XenStub.DRVDESC = "Xen Stub Device Driver"
    7.28 +XenStub.DRVDESC.CONSOLE = "Xen Stub Device Driver (Console)"
    7.29 +XenStub.DRVDESC.VFB = "Xen Stub Device Driver (Virtual Frame Buffer)"
    7.30 +XenStub.DRVDESC.VKBD = "Xen Stub Device Driver (Virtual Keyboard)
    7.31  DISK_NAME = "Xen Stub Device Driver Install Disk"
     8.1 --- a/xenvbd/scsiport.c	Mon Jun 02 11:58:26 2008 +1000
     8.2 +++ b/xenvbd/scsiport.c	Tue Jun 03 22:39:32 2008 +1000
     8.3 @@ -89,6 +89,7 @@ XenVbd_GetResponse(PXENVBD_DEVICE_DATA x
     8.4    return &xvdd->tmp_rep;
     8.5  }
     8.6  
     8.7 +#if 0
     8.8  static VOID
     8.9  XenVbd_HwScsiTimer(PVOID DeviceExtension)
    8.10  {
    8.11 @@ -98,6 +99,7 @@ XenVbd_HwScsiTimer(PVOID DeviceExtension
    8.12    xvdd->shadow_min_free = xvdd->shadow_free;
    8.13    ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 1 * 1000 * 1000);
    8.14  }
    8.15 +#endif
    8.16  
    8.17  static ULONG
    8.18  XenVbd_HwScsiFindAdapter(PVOID DeviceExtension, PVOID HwContext, PVOID BusInformation, PCHAR ArgumentString, PPORT_CONFIGURATION_INFORMATION ConfigInfo, PBOOLEAN Again)
    8.19 @@ -316,8 +318,10 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
    8.20    if (notify)
    8.21      xvdd->vectors.EvtChn_Notify(xvdd->vectors.context, xvdd->event_channel);
    8.22  
    8.23 +#if 0
    8.24    xvdd->shadow_min_free = xvdd->shadow_free;
    8.25    ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 1 * 1000 * 1000);
    8.26 +#endif
    8.27  
    8.28    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    8.29