win-pvdrivers

changeset 6:8f643f8e229b

Bug Fixes... trying to find a problem that turned out to be me running an old version of xen by mistake!
author James Harper <james.harper@bendigoit.com.au>
date Mon Nov 12 22:26:30 2007 +1100 (2007-11-12)
parents 2b0f6930eeeb
children 078654ce6a13
files xenpci/evtchn.c xenpci/target/xenpci.inf xenpci/xenbus.c xenpci/xenpci.c
line diff
     1.1 --- a/xenpci/evtchn.c	Sun Nov 11 22:50:42 2007 +1100
     1.2 +++ b/xenpci/evtchn.c	Mon Nov 12 22:26:30 2007 +1100
     1.3 @@ -102,21 +102,20 @@ EvtChn_AllocUnbound(domid_t Domain)
     1.4  NTSTATUS
     1.5  EvtChn_Bind(evtchn_port_t Port, PKSERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext)
     1.6  {
     1.7 -  //KdPrint((__DRIVER_NAME " --> EvtChn_Bind\n"));
     1.8 +  KdPrint((__DRIVER_NAME " --> EvtChn_Bind\n"));
     1.9  
    1.10 -  if(ev_actions[Port].ServiceRoutine != ServiceRoutine)
    1.11 +  if(ev_actions[Port].ServiceRoutine != NULL)
    1.12    {
    1.13      KdPrint((__DRIVER_NAME " Handler for port %d already registered, replacing\n", Port));
    1.14    }
    1.15  
    1.16    ev_actions[Port].ServiceContext = ServiceContext;
    1.17 -  //_WriteBarrier();
    1.18    KeMemoryBarrier();
    1.19    ev_actions[Port].ServiceRoutine = ServiceRoutine;
    1.20  
    1.21    EvtChn_Unmask(Port);
    1.22  
    1.23 -  //KdPrint((__DRIVER_NAME " <-- EvtChn_Bind\n"));
    1.24 +  KdPrint((__DRIVER_NAME " <-- EvtChn_Bind\n"));
    1.25  
    1.26    return STATUS_SUCCESS;
    1.27  }
     2.1 --- a/xenpci/target/xenpci.inf	Sun Nov 11 22:50:42 2007 +1100
     2.2 +++ b/xenpci/target/xenpci.inf	Mon Nov 12 22:26:30 2007 +1100
     2.3 @@ -3,7 +3,7 @@ Signature="$WINDOWS NT$"
     2.4  Class=Xen
     2.5  ClassGuid={C828ABE9-14CA-4445-BAA6-82C2376C6518}
     2.6  Provider=%JAMESHARPER%
     2.7 -DriverVer=11/08/2007,1.0.1.2
     2.8 +DriverVer=11/12/2007,1.0.1.5
     2.9  
    2.10  [DestinationDirs]
    2.11  DefaultDestDir = 12
     3.1 --- a/xenpci/xenbus.c	Sun Nov 11 22:50:42 2007 +1100
     3.2 +++ b/xenpci/xenbus.c	Mon Nov 12 22:26:30 2007 +1100
     3.3 @@ -260,16 +260,13 @@ static void xb_write(int type, int req_i
     3.4  }
     3.5  
     3.6  static struct xsd_sockmsg *
     3.7 -xenbus_msg_reply(int type,
     3.8 -                 xenbus_transaction_t trans,
     3.9 -                 struct write_req *io,
    3.10 -                 int nr_reqs)
    3.11 +xenbus_msg_reply(int type, xenbus_transaction_t trans, struct write_req *io, int nr_reqs)
    3.12  {
    3.13    int id;
    3.14  //  DEFINE_WAIT(w);
    3.15    struct xsd_sockmsg *rep;
    3.16  
    3.17 -  //KdPrint((__DRIVER_NAME " --> xenbus_msg_reply\n"));
    3.18 +  KdPrint((__DRIVER_NAME " --> xenbus_msg_reply\n"));
    3.19  
    3.20    id = allocate_xenbus_id();
    3.21  //  add_waiter(w, req_info[id].waitq);
    3.22 @@ -280,18 +277,17 @@ xenbus_msg_reply(int type,
    3.23  //  remove_waiter(w);
    3.24  //  wake(current);
    3.25  //
    3.26 -  //KdPrint((__DRIVER_NAME "     starting wait\n"));
    3.27 +  KdPrint((__DRIVER_NAME "     starting wait\n"));
    3.28  
    3.29    KeWaitForSingleObject(&req_info[id].WaitEvent, Executive, KernelMode, FALSE, NULL);
    3.30  
    3.31 -  //KdPrint((__DRIVER_NAME "     wait complete\n"));
    3.32 +  KdPrint((__DRIVER_NAME "     wait complete\n"));
    3.33  
    3.34    rep = req_info[id].Reply;
    3.35  //  BUG_ON(rep->req_id != id);
    3.36    release_xenbus_id(id);
    3.37 -  //KdPrint((__DRIVER_NAME " <-- xenbus_msg_reply\n"));
    3.38 +  KdPrint((__DRIVER_NAME " <-- xenbus_msg_reply\n"));
    3.39    return rep;
    3.40 -//  return NULL;
    3.41  }
    3.42  
    3.43  char *
    3.44 @@ -383,7 +379,7 @@ XenBus_Start()
    3.45    NTSTATUS status;
    3.46    int i;
    3.47  
    3.48 -  //KdPrint((__DRIVER_NAME " --> XenBus_Start\n"));
    3.49 +  KdPrint((__DRIVER_NAME " --> XenBus_Start\n"));
    3.50  
    3.51    InitializeObjectAttributes(&oa, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
    3.52    status = PsCreateSystemThread(&XenBus_ReadThreadHandle, THREAD_ALL_ACCESS, &oa, NULL, NULL, XenBus_ReadThreadProc, NULL);
    3.53 @@ -398,7 +394,7 @@ XenBus_Start()
    3.54  
    3.55    EvtChn_Bind(xen_store_evtchn, XenBus_Interrupt, NULL);
    3.56  
    3.57 -  //KdPrint((__DRIVER_NAME " <-- XenBus_Start\n"));
    3.58 +  KdPrint((__DRIVER_NAME " <-- XenBus_Start\n"));
    3.59  
    3.60    return STATUS_SUCCESS;
    3.61  }
    3.62 @@ -605,7 +601,7 @@ XenBus_AddWatch(xenbus_transaction_t xbt
    3.63    char Token[20];
    3.64    struct write_req req[2];
    3.65  
    3.66 -  //KdPrint((__DRIVER_NAME " --> XenBus_AddWatch\n"));
    3.67 +  KdPrint((__DRIVER_NAME " --> XenBus_AddWatch\n"));
    3.68  
    3.69    // check that Path < 128 chars
    3.70  
    3.71 @@ -640,7 +636,7 @@ XenBus_AddWatch(xenbus_transaction_t xbt
    3.72    XenBus_WatchEntries[i].Count = 0;
    3.73    XenBus_WatchEntries[i].Active = 1;
    3.74  
    3.75 -  //KdPrint((__DRIVER_NAME " <-- XenBus_AddWatch\n"));
    3.76 +  KdPrint((__DRIVER_NAME " <-- XenBus_AddWatch\n"));
    3.77  
    3.78    return NULL;
    3.79  }
     4.1 --- a/xenpci/xenpci.c	Sun Nov 11 22:50:42 2007 +1100
     4.2 +++ b/xenpci/xenpci.c	Mon Nov 12 22:26:30 2007 +1100
     4.3 @@ -93,7 +93,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
     4.4    size_t SystemStartOptionsLen;
     4.5    size_t i;
     4.6  
     4.7 -  //KdPrint((__DRIVER_NAME " --> DriverEntry\n"));
     4.8 +  KdPrint((__DRIVER_NAME " --> DriverEntry\n"));
     4.9  
    4.10    RtlInitUnicodeString(&RegKeyName, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
    4.11    InitializeObjectAttributes(&RegObjectAttributes, &RegKeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);
    4.12 @@ -172,7 +172,6 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    4.13  
    4.14    KdPrint((__DRIVER_NAME "     AutoEnumerate = %d\n", AutoEnumerate));
    4.15  
    4.16 -
    4.17    WDF_DRIVER_CONFIG_INIT(&config, XenPCI_AddDevice);
    4.18    status = WdfDriverCreate(
    4.19                        DriverObject,
    4.20 @@ -182,10 +181,10 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    4.21                        WDF_NO_HANDLE);
    4.22    if(!NT_SUCCESS(status))
    4.23    {
    4.24 -    //KdPrint((__DRIVER_NAME " WdfDriverCreate failed with status 0x%08x\n", status));
    4.25 +    KdPrint((__DRIVER_NAME " WdfDriverCreate failed with status 0x%08x\n", status));
    4.26    }
    4.27  
    4.28 -  //KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
    4.29 +  KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
    4.30  
    4.31    return status;
    4.32  }
    4.33 @@ -325,7 +324,7 @@ XenPCI_AddDevice(
    4.34  
    4.35    UNREFERENCED_PARAMETER(Driver);
    4.36  
    4.37 -  //KdPrint((__DRIVER_NAME " --> DeviceAdd\n"));
    4.38 +  KdPrint((__DRIVER_NAME " --> DeviceAdd\n"));
    4.39  
    4.40    // get PDO
    4.41    // get parent (should be PCI bus) (WdfPdoGetParent)
    4.42 @@ -341,8 +340,6 @@ XenPCI_AddDevice(
    4.43  //  FdoCallbacks.EvtDeviceRemoveAddedResources = XenPCI_RemoveAddedResources;
    4.44  //  WdfFdoInitSetEventCallbacks(DeviceInit, &FdoCallbacks);
    4.45  
    4.46 -  /*set the callback functions that will be 
    4.47 -  executed on PNP and Power events*/
    4.48    WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
    4.49    pnpPowerCallbacks.EvtDevicePrepareHardware = XenPCI_PrepareHardware;
    4.50    pnpPowerCallbacks.EvtDeviceReleaseHardware = XenPCI_ReleaseHardware;
    4.51 @@ -358,8 +355,7 @@ XenPCI_AddDevice(
    4.52    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&attributes, XENPCI_DEVICE_DATA);
    4.53  
    4.54    /*create a device instance.*/
    4.55 -  status = WdfDeviceCreate(&DeviceInit, 
    4.56 -           &attributes, &Device);  
    4.57 +  status = WdfDeviceCreate(&DeviceInit, &attributes, &Device);  
    4.58    if(!NT_SUCCESS(status))
    4.59    {
    4.60      KdPrint((__DRIVER_NAME "     WdfDeviceCreate failed with status 0x%08x\n", status));
    4.61 @@ -383,6 +379,7 @@ XenPCI_AddDevice(
    4.62  
    4.63    /*create the default IO queue. this one will 
    4.64    be used for all requests*/
    4.65 +/*
    4.66    WDF_IO_QUEUE_CONFIG_INIT_DEFAULT_QUEUE(&ioQConfig,
    4.67                                  WdfIoQueueDispatchSequential);
    4.68    ioQConfig.EvtIoDefault = XenPCI_IoDefault;
    4.69 @@ -394,7 +391,7 @@ XenPCI_AddDevice(
    4.70      KdPrint((__DRIVER_NAME "     WdfIoQueueCreate failed with status 0x%08x\n", status));
    4.71      return status;
    4.72    }
    4.73 -
    4.74 +*/
    4.75  /*
    4.76    status = WdfDeviceCreateDeviceInterface(Device, &GUID_INTERFACE_XENPCI, NULL);
    4.77    if(!NT_SUCCESS(status))
    4.78 @@ -414,7 +411,7 @@ XenPCI_AddDevice(
    4.79      return status;
    4.80    }
    4.81  
    4.82 -  //KdPrint((__DRIVER_NAME " <-- DeviceAdd\n"));
    4.83 +  KdPrint((__DRIVER_NAME " <-- DeviceAdd\n"));
    4.84    return status;
    4.85  }
    4.86  
    4.87 @@ -430,7 +427,7 @@ XenPCI_PrepareHardware(
    4.88  
    4.89    UNREFERENCED_PARAMETER(Device);
    4.90  
    4.91 -  //KdPrint((__DRIVER_NAME " --> EvtDevicePrepareHardware\n"));
    4.92 +  KdPrint((__DRIVER_NAME " --> EvtDevicePrepareHardware\n"));
    4.93  
    4.94    for (i = 0; i < WdfCmResourceListGetCount(ResourceList); i++)
    4.95    {
    4.96 @@ -498,7 +495,7 @@ XenPCI_PrepareHardware(
    4.97  
    4.98    //xen_reboot_init();
    4.99  
   4.100 -  //KdPrint((__DRIVER_NAME " <-- EvtDevicePrepareHardware\n"));
   4.101 +  KdPrint((__DRIVER_NAME " <-- EvtDevicePrepareHardware\n"));
   4.102  
   4.103    return status;
   4.104  }
   4.105 @@ -523,9 +520,9 @@ XenPCI_D0Entry(
   4.106    UNREFERENCED_PARAMETER(Device);
   4.107    UNREFERENCED_PARAMETER(PreviousState);
   4.108  
   4.109 -  //KdPrint((__DRIVER_NAME " --> EvtDeviceD0Entry\n"));
   4.110 +  KdPrint((__DRIVER_NAME " --> EvtDeviceD0Entry\n"));
   4.111  
   4.112 -  //KdPrint((__DRIVER_NAME " <-- EvtDeviceD0Entry\n"));
   4.113 +  KdPrint((__DRIVER_NAME " <-- EvtDeviceD0Entry\n"));
   4.114  
   4.115    return status;
   4.116  }
   4.117 @@ -546,22 +543,20 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
   4.118    UNREFERENCED_PARAMETER(Device);
   4.119    UNREFERENCED_PARAMETER(PreviousState);
   4.120  
   4.121 -  //KdPrint((__DRIVER_NAME " --> EvtDeviceD0EntryPostInterruptsEnabled\n"));
   4.122 +  KdPrint((__DRIVER_NAME " --> EvtDeviceD0EntryPostInterruptsEnabled\n"));
   4.123  
   4.124    XenBus_Start();
   4.125 +
   4.126 +  KdPrint((__DRIVER_NAME "     A\n"));
   4.127    
   4.128 -  //InitializeObjectAttributes(&oa, NULL, OBJ_KERNEL_HANDLE, NULL, NULL);
   4.129 -  //status = PsCreateSystemThread(&ThreadHandle, THREAD_ALL_ACCESS, &oa, NULL, NULL, XenBus_ThreadProc, NULL);
   4.130 -  //KdPrint((__DRIVER_NAME "     PsCreateSystemThread returned %08X\n", status));
   4.131 -
   4.132    response = XenBus_AddWatch(XBT_NIL, SHUTDOWN_PATH, XenBus_ShutdownHandler, NULL);
   4.133 -  //KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
   4.134 +  KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
   4.135  
   4.136    response = XenBus_AddWatch(XBT_NIL, BALLOON_PATH, XenBus_BalloonHandler, NULL);
   4.137 -  //KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
   4.138 +  KdPrint((__DRIVER_NAME "     shutdown watch response = '%s'\n", response)); 
   4.139  
   4.140    response = XenBus_AddWatch(XBT_NIL, "device", XenPCI_XenBusWatchHandler, NULL);
   4.141 -  //KdPrint((__DRIVER_NAME "     device watch response = '%s'\n", response)); 
   4.142 +  KdPrint((__DRIVER_NAME "     device watch response = '%s'\n", response)); 
   4.143  
   4.144    msgTypes = XenBus_List(XBT_NIL, "device", &Types);
   4.145    if (!msgTypes) {
   4.146 @@ -573,18 +568,7 @@ XenPCI_D0EntryPostInterruptsEnabled(WDFD
   4.147        ExFreePoolWithTag(Types[i], XENPCI_POOL_TAG);
   4.148      }
   4.149    }
   4.150 -//      msgInstances = XenBus_List(XBT_NIL, buffer, &Instances);
   4.151 -//      for (j = 0; Instances[j]; j++)
   4.152 -//      {
   4.153 -//        //KdPrint((__DRIVER_NAME "      ls %s[%d] -> %s\n", buffer, j, Instances[j]));
   4.154 -//
   4.155 -//        sprintf(buffer, "device/%s/%s", Types[i], Instances[j]);
   4.156 -//
   4.157 -//
   4.158 -//        ExFreePoolWithTag(Instances[j], XENPCI_POOL_TAG);
   4.159 -//      }
   4.160 -  
   4.161 -  //KdPrint((__DRIVER_NAME " <-- EvtDeviceD0EntryPostInterruptsEnabled\n"));
   4.162 +  KdPrint((__DRIVER_NAME " <-- EvtDeviceD0EntryPostInterruptsEnabled\n"));
   4.163  
   4.164    return status;
   4.165  }
   4.166 @@ -656,6 +640,7 @@ XenPCI_InterruptDisable(WDFINTERRUPT Int
   4.167    //KdPrint((__DRIVER_NAME " --> EvtInterruptDisable\n"));
   4.168  
   4.169    shared_info_area->vcpu_info[0].evtchn_upcall_mask = 1;
   4.170 +  // should we kick off any pending interrupts here?
   4.171  
   4.172    //KdPrint((__DRIVER_NAME " <-- EvtInterruptDisable\n"));
   4.173  
   4.174 @@ -808,7 +793,7 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   4.175  
   4.176    UNREFERENCED_PARAMETER(Data);
   4.177  
   4.178 -  //KdPrint((__DRIVER_NAME " --> HotPlugHandler\n"));
   4.179 +  KdPrint((__DRIVER_NAME " --> XenBusWatchHandle\n"));
   4.180  
   4.181    //KdPrint((__DRIVER_NAME "     %s\n", Path));
   4.182  
   4.183 @@ -854,7 +839,7 @@ XenPCI_XenBusWatchHandler(char *Path, PV
   4.184  
   4.185    FreeSplitString(Bits, Count);
   4.186    
   4.187 -  //KdPrint((__DRIVER_NAME " <-- HotPlugHandler\n"));  
   4.188 +  KdPrint((__DRIVER_NAME " <-- XenBusWatchHandle\n"));  
   4.189  }
   4.190  
   4.191  static void