win-pvdrivers

diff xenpci/xenpci.c @ 75:b7863ede7a37

Created a 'xenenum' driver for when the device driver should attach to xen\???\xxx rather than xen\xxx
author James Harper <james.harper@bendigoit.com.au>
date Thu Dec 27 20:49:42 2007 +1100 (2007-12-27)
parents f74723639713
children dfa772949c6e
line diff
     1.1 --- a/xenpci/xenpci.c	Thu Dec 20 21:37:20 2007 +1100
     1.2 +++ b/xenpci/xenpci.c	Thu Dec 27 20:49:42 2007 +1100
     1.3 @@ -383,7 +383,7 @@ XenPCI_AddDevice(
     1.4      return Status;
     1.5    }
     1.6  
     1.7 -  Status = WdfDeviceCreateDeviceInterface(Device, (LPGUID)&GUID_XEN_IFACE_XEN, NULL);
     1.8 +  Status = WdfDeviceCreateDeviceInterface(Device, (LPGUID)&GUID_XEN_IFACE, NULL);
     1.9    if (!NT_SUCCESS(Status))
    1.10    {
    1.11      KdPrint((__DRIVER_NAME "     WdfDeviceCreateDeviceInterface failed 0x%08x\n", Status));
    1.12 @@ -795,66 +795,35 @@ XenPCI_ChildListCreateDevice(
    1.13    memcpy(&ChildDeviceData->InterruptRaw, &InterruptRaw, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
    1.14    memcpy(&ChildDeviceData->InterruptTranslated, &InterruptTranslated, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
    1.15    
    1.16 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->EvtChnInterface);
    1.17 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Version = 1;
    1.18 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
    1.19 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
    1.20 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
    1.21 -  ChildDeviceData->EvtChnInterface.Bind = EvtChn_Bind;
    1.22 -  ChildDeviceData->EvtChnInterface.Unbind = EvtChn_Unbind;
    1.23 -  ChildDeviceData->EvtChnInterface.Mask = EvtChn_Mask;
    1.24 -  ChildDeviceData->EvtChnInterface.Unmask = EvtChn_Unmask;
    1.25 -  ChildDeviceData->EvtChnInterface.Notify = EvtChn_Notify;
    1.26 -  ChildDeviceData->EvtChnInterface.AllocUnbound = EvtChn_AllocUnbound;
    1.27 -  ChildDeviceData->EvtChnInterface.BindDpc = EvtChn_BindDpc;
    1.28 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->EvtChnInterface, &GUID_XEN_IFACE_EVTCHN, NULL);
    1.29 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
    1.30 -  if (!NT_SUCCESS(status))
    1.31 -  {
    1.32 -    return status;
    1.33 -  }
    1.34 -
    1.35 -/*
    1.36    ChildDeviceData->XenInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->XenInterface);
    1.37    ChildDeviceData->XenInterface.InterfaceHeader.Version = 1;
    1.38 -  ChildDeviceData->XenInterface.InterfaceHeader.Context = NULL;
    1.39 +  ChildDeviceData->XenInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
    1.40    ChildDeviceData->XenInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
    1.41    ChildDeviceData->XenInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
    1.42 -  ChildDeviceData->XenInterface.AllocMMIO = XenPCI_AllocMMIO;
    1.43 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE_XEN, NULL);
    1.44 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
    1.45 -  if (!NT_SUCCESS(status)) {
    1.46 -    return status;
    1.47 -  }
    1.48 -*/
    1.49  
    1.50 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->GntTblInterface);
    1.51 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Version = 1;
    1.52 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
    1.53 -  ChildDeviceData->GntTblInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
    1.54 -  ChildDeviceData->GntTblInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
    1.55 -  ChildDeviceData->GntTblInterface.GrantAccess = GntTbl_GrantAccess;
    1.56 -  ChildDeviceData->GntTblInterface.EndAccess = GntTbl_EndAccess;
    1.57 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->GntTblInterface, &GUID_XEN_IFACE_GNTTBL, NULL);
    1.58 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
    1.59 -  if (!NT_SUCCESS(status)) {
    1.60 -    return status;
    1.61 -  }
    1.62 +  ChildDeviceData->XenInterface.AllocMMIO = XenPCI_AllocMMIO;
    1.63  
    1.64 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->XenBusInterface);
    1.65 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Version = 1;
    1.66 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
    1.67 -  //XenBusInterface.InterfaceHeader.Context = ExAllocatePoolWithTag(NonPagedPool, (strlen(XenIdentificationDesc->Path) + 1), XENPCI_POOL_TAG);
    1.68 -  //strcpy(XenBusInterface.InterfaceHeader.Context, XenIdentificationDesc->Path);
    1.69 -  ChildDeviceData->XenBusInterface.Read = XenBus_Read;
    1.70 -  ChildDeviceData->XenBusInterface.Write = XenBus_Write;
    1.71 -  ChildDeviceData->XenBusInterface.Printf = XenBus_Printf;
    1.72 -  ChildDeviceData->XenBusInterface.StartTransaction = XenBus_StartTransaction;
    1.73 -  ChildDeviceData->XenBusInterface.EndTransaction = XenBus_EndTransaction;
    1.74 -  ChildDeviceData->XenBusInterface.List = XenBus_List;
    1.75 -  ChildDeviceData->XenBusInterface.AddWatch = XenBus_AddWatch;
    1.76 -  ChildDeviceData->XenBusInterface.RemWatch = XenBus_RemWatch;
    1.77 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenBusInterface, &GUID_XEN_IFACE_XENBUS, NULL);
    1.78 +  ChildDeviceData->XenInterface.EvtChn_Bind = EvtChn_Bind;
    1.79 +  ChildDeviceData->XenInterface.EvtChn_Unbind = EvtChn_Unbind;
    1.80 +  ChildDeviceData->XenInterface.EvtChn_Mask = EvtChn_Mask;
    1.81 +  ChildDeviceData->XenInterface.EvtChn_Unmask = EvtChn_Unmask;
    1.82 +  ChildDeviceData->XenInterface.EvtChn_Notify = EvtChn_Notify;
    1.83 +  ChildDeviceData->XenInterface.EvtChn_AllocUnbound = EvtChn_AllocUnbound;
    1.84 +  ChildDeviceData->XenInterface.EvtChn_BindDpc = EvtChn_BindDpc;
    1.85 +
    1.86 +  ChildDeviceData->XenInterface.GntTbl_GrantAccess = GntTbl_GrantAccess;
    1.87 +  ChildDeviceData->XenInterface.GntTbl_EndAccess = GntTbl_EndAccess;
    1.88 +
    1.89 +  ChildDeviceData->XenInterface.XenBus_Read = XenBus_Read;
    1.90 +  ChildDeviceData->XenInterface.XenBus_Write = XenBus_Write;
    1.91 +  ChildDeviceData->XenInterface.XenBus_Printf = XenBus_Printf;
    1.92 +  ChildDeviceData->XenInterface.XenBus_StartTransaction = XenBus_StartTransaction;
    1.93 +  ChildDeviceData->XenInterface.XenBus_EndTransaction = XenBus_EndTransaction;
    1.94 +  ChildDeviceData->XenInterface.XenBus_List = XenBus_List;
    1.95 +  ChildDeviceData->XenInterface.XenBus_AddWatch = XenBus_AddWatch;
    1.96 +  ChildDeviceData->XenInterface.XenBus_RemWatch = XenBus_RemWatch;
    1.97 +
    1.98 +  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE, NULL);
    1.99    status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
   1.100    if (!NT_SUCCESS(status)) {
   1.101      return status;