win-pvdrivers

changeset 4:3bf1f48005d8

Minor Bugfixes and updates
author James Harper <james.harper@bendigoit.com.au>
date Sun Nov 11 20:51:10 2007 +1100 (2007-11-11)
parents 0cd078f41eed
children 2b0f6930eeeb
files TODO.txt xenpci/xenpci.c xenvbd/target/xenvbd.inf xenvbd/xenvbd.c
line diff
     1.1 --- a/TODO.txt	Sun Nov 11 16:07:56 2007 +1100
     1.2 +++ b/TODO.txt	Sun Nov 11 20:51:10 2007 +1100
     1.3 @@ -9,6 +9,7 @@ Known problems or things that need doing
     1.4  . Probably really poor performance - no optimisation done at all yet.
     1.5  . Probably lots of other things too.
     1.6  . Put up a binary release so it can get some further testing
     1.7 +. Write an installer for the above binaries to automate everything
     1.8  
     1.9  TODO:
    1.10  . Do some performance testing
     2.1 --- a/xenpci/xenpci.c	Sun Nov 11 16:07:56 2007 +1100
     2.2 +++ b/xenpci/xenpci.c	Sun Nov 11 20:51:10 2007 +1100
     2.3 @@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fi
     2.4  #include <stdlib.h>
     2.5  
     2.6  #define SHUTDOWN_PATH "control/shutdown"
     2.7 +#define BALLOON_PATH "memory/target"
     2.8  
     2.9  DRIVER_INITIALIZE DriverEntry;
    2.10  static NTSTATUS
    2.11 @@ -58,6 +59,8 @@ XenPCI_RemoveAddedResources(WDFDEVICE De
    2.12  static VOID
    2.13  XenBus_ShutdownHandler(char *Path, PVOID Data);
    2.14  static VOID
    2.15 +XenBus_BalloonHandler(char *Path, PVOID Data);
    2.16 +static VOID
    2.17  XenPCI_XenBusWatchHandler(char *Path, PVOID Data);
    2.18  
    2.19  #ifdef ALLOC_PRAGMA
    2.20 @@ -315,7 +318,7 @@ XenPCI_AddDevice(
    2.21    WDF_INTERRUPT_CONFIG interruptConfig;
    2.22    PNP_BUS_INFORMATION busInfo;
    2.23    BUS_INTERFACE_STANDARD BusInterface;
    2.24 -  WDFDEVICE Parent;
    2.25 +  //WDFDEVICE Parent;
    2.26  
    2.27    //PDEVICE_OBJECT pdo;
    2.28    //ULONG propertyAddress, length;
    2.29 @@ -554,6 +557,9 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
    2.30    response = XenBus_AddWatch(XBT_NIL, SHUTDOWN_PATH, XenBus_ShutdownHandler, NULL);
    2.31    //KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
    2.32  
    2.33 +  response = XenBus_AddWatch(XBT_NIL, BALLOON_PATH, XenBus_BalloonHandler, NULL);
    2.34 +  //KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
    2.35 +
    2.36    response = XenBus_AddWatch(XBT_NIL, "device", XenPCI_XenBusWatchHandler, NULL);
    2.37    //KdPrint((__DRIVER_NAME "     device watch response = '%s'\n", response)); 
    2.38  
    2.39 @@ -852,22 +858,22 @@ XenPCI_XenBusWatchHandler(char *Path, PV
    2.40  }
    2.41  
    2.42  static void
    2.43 -XenBus_ShutdownHandler(char *Path, PVOID StartContext)
    2.44 +XenBus_ShutdownHandler(char *Path, PVOID Data)
    2.45  {
    2.46    char *value;
    2.47    xenbus_transaction_t xbt;
    2.48    int retry;
    2.49  
    2.50    UNREFERENCED_PARAMETER(Path);
    2.51 -  UNREFERENCED_PARAMETER(StartContext);
    2.52 +  UNREFERENCED_PARAMETER(Data);
    2.53  
    2.54 -  //KdPrint((__DRIVER_NAME " --> XenBus_ShutdownHandler\n"));
    2.55 +  KdPrint((__DRIVER_NAME " --> XenBus_ShutdownHandler\n"));
    2.56  
    2.57    XenBus_StartTransaction(&xbt);
    2.58  
    2.59    XenBus_Read(XBT_NIL, SHUTDOWN_PATH, &value);
    2.60  
    2.61 -  //KdPrint((__DRIVER_NAME "     Shutdown Value = %s\n", value));
    2.62 +  KdPrint((__DRIVER_NAME "     Shutdown Value = %s\n", value));
    2.63  
    2.64    // should check for error here... but why have we been called at all???
    2.65    if (value != NULL && strlen(value) != 0)
    2.66 @@ -875,7 +881,33 @@ XenBus_ShutdownHandler(char *Path, PVOID
    2.67  
    2.68    XenBus_EndTransaction(xbt, 0, &retry);
    2.69    
    2.70 -  //KdPrint((__DRIVER_NAME " <-- XenBus_ShutdownHandler\n"));
    2.71 +  KdPrint((__DRIVER_NAME " <-- XenBus_ShutdownHandler\n"));
    2.72 +}
    2.73 +
    2.74 +static VOID
    2.75 +XenBus_BalloonHandler(char *Path, PVOID Data)
    2.76 +{
    2.77 +  char *value;
    2.78 +  xenbus_transaction_t xbt;
    2.79 +  int retry;
    2.80 +
    2.81 +  UNREFERENCED_PARAMETER(Path);
    2.82 +  UNREFERENCED_PARAMETER(Data);
    2.83 +
    2.84 +  KdPrint((__DRIVER_NAME " --> XenBus_BalloonHandler\n"));
    2.85 +
    2.86 +  XenBus_StartTransaction(&xbt);
    2.87 +
    2.88 +  XenBus_Read(XBT_NIL, BALLOON_PATH, &value);
    2.89 +
    2.90 +  KdPrint((__DRIVER_NAME "     Balloon Value = %s\n", value));
    2.91 +
    2.92 +  // use the memory_op(unsigned int op, void *arg) hypercall to adjust this
    2.93 +  // use XENMEM_increase_reservation and XENMEM_decrease_reservation
    2.94 +
    2.95 +  XenBus_EndTransaction(xbt, 0, &retry);
    2.96 +  
    2.97 +  KdPrint((__DRIVER_NAME " <-- XenBus_BalloonHandler\n"));
    2.98  }
    2.99  
   2.100  /*
   2.101 @@ -941,6 +973,7 @@ XenPCI_FilterRemoveResourceRequirements(
   2.102    return status;
   2.103  }
   2.104  
   2.105 +
   2.106  static NTSTATUS
   2.107  XenPCI_FilterAddResourceRequirements(WDFDEVICE Device, WDFIORESREQLIST RequirementsList)
   2.108  {
     3.1 --- a/xenvbd/target/xenvbd.inf	Sun Nov 11 16:07:56 2007 +1100
     3.2 +++ b/xenvbd/target/xenvbd.inf	Sun Nov 11 20:51:10 2007 +1100
     3.3 @@ -3,7 +3,7 @@ Signature="$WINDOWS NT$"
     3.4  Class=SCSIAdapter
     3.5  ClassGuid={B968331F-9539-47d0-855E-66CB6AA613E2}
     3.6  Provider=%JAMESHARPER%
     3.7 -DriverVer=11/09/2007,1.0.1.285
     3.8 +DriverVer=11/09/2007,1.0.1.286
     3.9  
    3.10  [DestinationDirs]
    3.11  DefaultDestDir = 12
     4.1 --- a/xenvbd/xenvbd.c	Sun Nov 11 16:07:56 2007 +1100
     4.2 +++ b/xenvbd/xenvbd.c	Sun Nov 11 20:51:10 2007 +1100
     4.3 @@ -563,6 +563,16 @@ XenVbd_DpcThreadProc(WDFDPC Dpc)
     4.4      }
     4.5    }
     4.6  
     4.7 +  KeReleaseSpinLock(&ChildDeviceData->Lock, KIrql);
     4.8 +
     4.9 +  for (j = 0; j < IrpCount; j++)
    4.10 +  {
    4.11 +    IoCompleteRequest(Irps[j], IO_NO_INCREMENT);
    4.12 +    //ChildDeviceData->IrpCompleted++;
    4.13 +  }
    4.14 +
    4.15 +  KeAcquireSpinLock(&ChildDeviceData->Lock, &KIrql);
    4.16 +
    4.17    while (!RING_FULL(&ChildDeviceData->Ring) && (ListEntry = (XenVbd_ListEntry *)/*ExInterlocked*/RemoveHeadList(&ChildDeviceData->IrpListHead)) != (XenVbd_ListEntry *)&ChildDeviceData->IrpListHead)
    4.18    {
    4.19      //ChildDeviceData->IrpRemovedFromList++;
    4.20 @@ -571,12 +581,6 @@ XenVbd_DpcThreadProc(WDFDPC Dpc)
    4.21    }
    4.22  
    4.23    KeReleaseSpinLock(&ChildDeviceData->Lock, KIrql);
    4.24 -
    4.25 -  for (j = 0; j < IrpCount; j++)
    4.26 -  {
    4.27 -    IoCompleteRequest(Irps[j], IO_NO_INCREMENT);
    4.28 -    //ChildDeviceData->IrpCompleted++;
    4.29 -  }
    4.30    //KdPrint((__DRIVER_NAME " <-- XenVbd_DpcThreadProc\n"));
    4.31    //KdPrint((__DRIVER_NAME " <-- XenVbd_DpcThreadProc (AddedToList = %d, RemovedFromList = %d, AddedToRing = %d, AddedToRingAtLastNotify = %d, AddedToRingAtLastInterrupt = %d, AddedToRingAtLastDpc = %d, RemovedFromRing = %d, IrpCompleted = %d)\n", ChildDeviceData->IrpAddedToList, ChildDeviceData->IrpRemovedFromList, ChildDeviceData->IrpAddedToRing, ChildDeviceData->IrpAddedToRingAtLastNotify, ChildDeviceData->IrpAddedToRingAtLastInterrupt, ChildDeviceData->IrpAddedToRingAtLastDpc, ChildDeviceData->IrpRemovedFromRing, ChildDeviceData->IrpCompleted));
    4.32  }