win-pvdrivers

changeset 312:bb891f6d10e4 0.9.9

Fixed some POWER bugs causing 0x9F BSoD on shutdown.
Tweaked drivers to refuse to hot upgrade (eg reboot required), but still allow 'xm block-detach' etc to work.
author James Harper <james.harper@bendigoit.com.au>
date Sat Jun 14 23:16:44 2008 +1000 (2008-06-14)
parents c25d8b936290
children ec53700c0df4
files common.inc installer.nsi xenconfig/xenconfig.c xenhide/xenhide.c xenpci/xenpci.h xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c
line diff
     1.1 --- a/common.inc	Fri Jun 13 22:47:38 2008 +1000
     1.2 +++ b/common.inc	Sat Jun 14 23:16:44 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.8.8
     1.5 +VERSION=0.9.9.0
     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	Fri Jun 13 22:47:38 2008 +1000
     2.2 +++ b/installer.nsi	Sat Jun 14 23:16:44 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.9-pre2"
     2.8 +!define Version "0.9.9"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
     3.1 --- a/xenconfig/xenconfig.c	Fri Jun 13 22:47:38 2008 +1000
     3.2 +++ b/xenconfig/xenconfig.c	Sat Jun 14 23:16:44 2008 +1000
     3.3 @@ -39,6 +39,18 @@ XenConfig_AddDevice();
     3.4  
     3.5  static BOOLEAN gplpv;
     3.6  
     3.7 +static NTSTATUS
     3.8 +XenConfig_Power(PDEVICE_OBJECT device_object, PIRP irp)
     3.9 +{
    3.10 +  NTSTATUS status;
    3.11 +  PXENCONFIG_DEVICE_DATA xcdd = device_object->DeviceExtension;
    3.12 +
    3.13 +  PoStartNextPowerIrp(irp);
    3.14 +  IoSkipCurrentIrpStackLocation(irp);
    3.15 +  status = PoCallDriver(xcdd->lower_do, irp);
    3.16 +  return status;
    3.17 +}
    3.18 +
    3.19  NTSTATUS
    3.20  DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
    3.21  {
    3.22 @@ -52,6 +64,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    3.23    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
    3.24      DriverObject->MajorFunction[i] = XenConfig_Pass;
    3.25    DriverObject->MajorFunction[IRP_MJ_PNP] = XenConfig_Pnp;
    3.26 +  DriverObject->MajorFunction[IRP_MJ_POWER] = XenConfig_Power;
    3.27    DriverObject->DriverExtension->AddDevice = XenConfig_AddDevice;
    3.28  
    3.29    KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
     4.1 --- a/xenhide/xenhide.c	Fri Jun 13 22:47:38 2008 +1000
     4.2 +++ b/xenhide/xenhide.c	Sat Jun 14 23:16:44 2008 +1000
     4.3 @@ -39,6 +39,18 @@ XenHide_AddDevice();
     4.4  
     4.5  static BOOLEAN gplpv;
     4.6  
     4.7 +static NTSTATUS
     4.8 +XenHide_Power(PDEVICE_OBJECT device_object, PIRP irp)
     4.9 +{
    4.10 +  NTSTATUS status;
    4.11 +  PXENHIDE_DEVICE_DATA xhdd = (PXENHIDE_DEVICE_DATA)device_object->DeviceExtension;
    4.12 +
    4.13 +  PoStartNextPowerIrp(irp);
    4.14 +  IoSkipCurrentIrpStackLocation(irp);
    4.15 +  status = PoCallDriver(xhdd->lower_do, irp);
    4.16 +  return status;
    4.17 +}
    4.18 +
    4.19  NTSTATUS
    4.20  DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
    4.21  {
    4.22 @@ -140,6 +152,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    4.23    for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
    4.24      DriverObject->MajorFunction[i] = XenHide_Pass;
    4.25    DriverObject->MajorFunction[IRP_MJ_PNP] = XenHide_Pnp;
    4.26 +  DriverObject->MajorFunction[IRP_MJ_POWER] = XenHide_Power;
    4.27    DriverObject->DriverExtension->AddDevice = XenHide_AddDevice;
    4.28  
    4.29    KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
     5.1 --- a/xenpci/xenpci.h	Fri Jun 13 22:47:38 2008 +1000
     5.2 +++ b/xenpci/xenpci.h	Sat Jun 14 23:16:44 2008 +1000
     5.3 @@ -226,7 +226,8 @@ typedef struct {
     5.4    XENPCI_COMMON common;
     5.5    PDEVICE_OBJECT bus_pdo;
     5.6    PDEVICE_OBJECT bus_fdo;
     5.7 -  BOOLEAN ReportedMissing;
     5.8 +  BOOLEAN eject_requested;
     5.9 +  BOOLEAN reported_missing;
    5.10    char path[128];
    5.11    char device[128];
    5.12    ULONG index;
     6.1 --- a/xenpci/xenpci_fdo.c	Fri Jun 13 22:47:38 2008 +1000
     6.2 +++ b/xenpci/xenpci_fdo.c	Sat Jun 14 23:16:44 2008 +1000
     6.3 @@ -859,7 +859,7 @@ XenPci_Pnp_QueryBusRelationsCallback(PDE
     6.4          child = (PXEN_CHILD)child->entry.Flink;
     6.5          RemoveEntryList((PLIST_ENTRY)old_child);
     6.6          xppdd = old_child->context;
     6.7 -        xppdd->ReportedMissing = TRUE;
     6.8 +        xppdd->reported_missing = TRUE;
     6.9          ObDereferenceObject(xppdd->common.pdo);
    6.10          ExFreePoolWithTag(old_child, XENPCI_POOL_TAG);
    6.11        }
     7.1 --- a/xenpci/xenpci_pdo.c	Fri Jun 13 22:47:38 2008 +1000
     7.2 +++ b/xenpci/xenpci_pdo.c	Sat Jun 14 23:16:44 2008 +1000
     7.3 @@ -162,6 +162,7 @@ XenPci_BackEndStateHandler(char *Path, P
     7.4        if (xppdd->common.current_pnp_state == Started)
     7.5        {
     7.6          KdPrint((__DRIVER_NAME "     Sending RequestDeviceEject\n"));
     7.7 +        xppdd->eject_requested = TRUE;
     7.8          IoRequestDeviceEject(xppdd->common.pdo);
     7.9        }
    7.10        else
    7.11 @@ -703,7 +704,7 @@ XenPci_Pnp_RemoveDevice(PDEVICE_OBJECT d
    7.12      SET_PNP_STATE(&xppdd->common, Removed);
    7.13      IoInvalidateDeviceRelations(xppdd->bus_pdo, BusRelations);
    7.14    }
    7.15 -  if (xppdd->ReportedMissing)
    7.16 +  if (xppdd->reported_missing)
    7.17    {
    7.18      IoDeleteDevice(xppdd->common.pdo);
    7.19    }
    7.20 @@ -798,7 +799,7 @@ XenPci_Pnp_QueryCapabilities(PDEVICE_OBJ
    7.21    stack = IoGetCurrentIrpStackLocation(irp);
    7.22    dc = stack->Parameters.DeviceCapabilities.Capabilities;
    7.23    dc->LockSupported = FALSE;
    7.24 -  dc->EjectSupported = FALSE; //TRUE;
    7.25 +  dc->EjectSupported = TRUE;
    7.26    dc->Removable = TRUE;
    7.27    dc->DockDevice = FALSE;
    7.28    dc->UniqueID = FALSE;
    7.29 @@ -864,8 +865,15 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
    7.30  
    7.31    case IRP_MN_QUERY_REMOVE_DEVICE:
    7.32      KdPrint((__DRIVER_NAME "     IRP_MN_QUERY_REMOVE_DEVICE (status = %08x)\n", irp->IoStatus.Status));
    7.33 -    SET_PNP_STATE(&xppdd->common, RemovePending);
    7.34 -    status = STATUS_SUCCESS;
    7.35 +    if (xppdd->eject_requested)
    7.36 +    {
    7.37 +      SET_PNP_STATE(&xppdd->common, RemovePending);
    7.38 +      status = STATUS_SUCCESS;
    7.39 +    }
    7.40 +    else
    7.41 +    {
    7.42 +      status = STATUS_UNSUCCESSFUL;
    7.43 +    }
    7.44      break;
    7.45  
    7.46    case IRP_MN_REMOVE_DEVICE:
    7.47 @@ -1060,7 +1068,12 @@ XenPci_Pnp_Pdo(PDEVICE_OBJECT device_obj
    7.48        break;
    7.49      }
    7.50      break;
    7.51 -        
    7.52 +
    7.53 +  case IRP_MN_EJECT:
    7.54 +    KdPrint((__DRIVER_NAME "     IRP_MN_EJECT\n"));
    7.55 +    status = STATUS_SUCCESS;
    7.56 +    break;
    7.57 +      
    7.58    default:
    7.59      KdPrint((__DRIVER_NAME "     Unhandled Minor = %d, Status = %08x\n", stack->MinorFunction, irp->IoStatus.Status));
    7.60      status = irp->IoStatus.Status;