win-pvdrivers

diff xenpci/xenpci_pdo.c @ 1022:cd72cd0e1c19

hooking debug doesn't survive hibernate under win8. Remove it.
Remove initial balloon down - doesn't work under xen 4.2 without xenbus being loaded
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 19 15:11:49 2013 +1100 (2013-02-19)
parents df03fde445b8
children d9a2a6de2ab4
line diff
     1.1 --- a/xenpci/xenpci_pdo.c	Wed Feb 13 23:37:17 2013 +1100
     1.2 +++ b/xenpci/xenpci_pdo.c	Tue Feb 19 15:11:49 2013 +1100
     1.3 @@ -31,8 +31,6 @@ static EVT_WDF_DEVICE_D0_EXIT XenPciPdo_
     1.4  static EVT_WDF_DEVICE_USAGE_NOTIFICATION XenPciPdo_EvtDeviceUsageNotification;
     1.5  static EVT_WDF_DEVICE_PNP_STATE_CHANGE_NOTIFICATION XenPci_EvtDevicePnpStateChange;
     1.6  
     1.7 -
     1.8 -      
     1.9  /*
    1.10  Called at PASSIVE_LEVEL(?)
    1.11  Called during restore
    1.12 @@ -148,7 +146,7 @@ NTSTATUS
    1.13  XenPciPdo_EvtDeviceD0Entry(WDFDEVICE device, WDF_POWER_DEVICE_STATE previous_state) {
    1.14    NTSTATUS status = STATUS_SUCCESS;
    1.15    PXENPCI_PDO_DEVICE_DATA xppdd = GetXppdd(device);
    1.16 -  //PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
    1.17 +  PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
    1.18    CHAR path[128];
    1.19    
    1.20    FUNCTION_ENTER();
    1.21 @@ -189,6 +187,12 @@ XenPciPdo_EvtDeviceD0Entry(WDFDEVICE dev
    1.22      return status;
    1.23    }
    1.24  
    1.25 +  if (previous_state == WdfPowerDevicePrepareForHibernation && xppdd->device_callback) {
    1.26 +    FUNCTION_MSG("Restoring watch %s\n", xppdd->device);
    1.27 +    RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
    1.28 +    XenBus_AddWatch(xpdd, XBT_NIL, path, XenPci_BackendStateCallback, xppdd);
    1.29 +  }
    1.30 +
    1.31    if (!NT_SUCCESS(status)) {
    1.32      RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
    1.33      //XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackendStateHandler, device);
    1.34 @@ -206,7 +210,7 @@ NTSTATUS
    1.35  XenPciPdo_EvtDeviceD0Exit(WDFDEVICE device, WDF_POWER_DEVICE_STATE target_state) {
    1.36    NTSTATUS status = STATUS_SUCCESS;
    1.37    PXENPCI_PDO_DEVICE_DATA xppdd = GetXppdd(device);
    1.38 -  //PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
    1.39 +  PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
    1.40    char path[128];
    1.41    
    1.42    UNREFERENCED_PARAMETER(device);
    1.43 @@ -250,9 +254,12 @@ XenPciPdo_EvtDeviceD0Exit(WDFDEVICE devi
    1.44    }
    1.45    
    1.46    /* Remove watch on backend state */
    1.47 -  RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
    1.48 -  //XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackendStateHandler, device);
    1.49 -  
    1.50 +  /* even if hibernate */
    1.51 +  if (xppdd->device_callback) {
    1.52 +    FUNCTION_MSG("Removing watch %s\n", xppdd->device);
    1.53 +    RtlStringCbPrintfA(path, ARRAY_SIZE(path), "%s/state", xppdd->backend_path);
    1.54 +    XenBus_RemWatch(xpdd, XBT_NIL, path, XenPci_BackendStateCallback, xppdd);
    1.55 +  }
    1.56    FUNCTION_EXIT();
    1.57    
    1.58    return status;