win-pvdrivers

changeset 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 06b4321b7068
children dfa772949c6e
files common/include/evtchn_public.h common/include/gnttbl_public.h common/include/xen_public.h common/include/xenbus_public.h dirs xenaddresource/sources xenaddresource/xenaddresource.h xenenum/makefile xenenum/makefile.inc xenenum/sources xenenum/xenenum.c xenenum/xenenum.h xenenum/xenenum.inx xenhide/sources xenhide/xenhide.h xennet/xennet.c xennet/xennet.inx xenpci/sources xenpci/xenpci.c xenpci/xenpci.h xenvbd/sources xenvbd/xenvbd.c xenvbd/xenvbd.h
line diff
     1.1 --- a/common/include/evtchn_public.h	Thu Dec 20 21:37:20 2007 +1100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,57 +0,0 @@
     1.4 -/*
     1.5 -PV Drivers for Windows Xen HVM Domains
     1.6 -Copyright (C) 2007 James Harper
     1.7 -
     1.8 -This program is free software; you can redistribute it and/or
     1.9 -modify it under the terms of the GNU General Public License
    1.10 -as published by the Free Software Foundation; either version 2
    1.11 -of the License, or (at your option) any later version.
    1.12 -
    1.13 -This program is distributed in the hope that it will be useful,
    1.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.16 -GNU General Public License for more details.
    1.17 -
    1.18 -You should have received a copy of the GNU General Public License
    1.19 -along with this program; if not, write to the Free Software
    1.20 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    1.21 -*/
    1.22 -
    1.23 -#if !defined(_EVTCHN_PUBLIC_H_)
    1.24 -#define _EVTCHN_PUBLIC_H_
    1.25 -
    1.26 -DEFINE_GUID( GUID_XEN_IFACE_EVTCHN, 0xD2D20756, 0xDE69, 0x4447, 0x8A, 0x7D, 0x98, 0x37, 0x19, 0x7D, 0x61, 0x66);
    1.27 -//{D2D20756-DE69-4447-8A7D-9837197D6166}
    1.28 -
    1.29 -typedef NTSTATUS
    1.30 -(*PXEN_EVTCHN_BIND)(PVOID Context, evtchn_port_t Port, PKSERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext);
    1.31 -
    1.32 -typedef NTSTATUS
    1.33 -(*PXEN_EVTCHN_UNBIND)(PVOID Context, evtchn_port_t Port);
    1.34 -
    1.35 -typedef NTSTATUS
    1.36 -(*PXEN_EVTCHN_MASK)(PVOID Context, evtchn_port_t Port);
    1.37 -
    1.38 -typedef NTSTATUS
    1.39 -(*PXEN_EVTCHN_UNMASK)(PVOID Context, evtchn_port_t Port);
    1.40 -
    1.41 -typedef NTSTATUS
    1.42 -(*PXEN_EVTCHN_NOTIFY)(PVOID Context, evtchn_port_t Port);
    1.43 -
    1.44 -typedef evtchn_port_t
    1.45 -(*PXEN_EVTCHN_ALLOCUNBOUND)(PVOID Context, domid_t Domain);
    1.46 -
    1.47 -typedef struct _XENBUS_IFACE_EVTCHN {
    1.48 -  INTERFACE InterfaceHeader;
    1.49 -
    1.50 -  PXEN_EVTCHN_BIND Bind;
    1.51 -  PXEN_EVTCHN_UNBIND Unbind;
    1.52 -  PXEN_EVTCHN_MASK Mask;
    1.53 -  PXEN_EVTCHN_UNMASK Unmask;
    1.54 -  PXEN_EVTCHN_NOTIFY Notify;
    1.55 -  PXEN_EVTCHN_ALLOCUNBOUND AllocUnbound;
    1.56 -  PXEN_EVTCHN_BIND BindDpc;
    1.57 -
    1.58 -} XEN_IFACE_EVTCHN, *PXEN_IFACE_EVTCHN;
    1.59 -
    1.60 -#endif
    1.61 \ No newline at end of file
     2.1 --- a/common/include/gnttbl_public.h	Thu Dec 20 21:37:20 2007 +1100
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,38 +0,0 @@
     2.4 -/*
     2.5 -PV Drivers for Windows Xen HVM Domains
     2.6 -Copyright (C) 2007 James Harper
     2.7 -
     2.8 -This program is free software; you can redistribute it and/or
     2.9 -modify it under the terms of the GNU General Public License
    2.10 -as published by the Free Software Foundation; either version 2
    2.11 -of the License, or (at your option) any later version.
    2.12 -
    2.13 -This program is distributed in the hope that it will be useful,
    2.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2.16 -GNU General Public License for more details.
    2.17 -
    2.18 -You should have received a copy of the GNU General Public License
    2.19 -along with this program; if not, write to the Free Software
    2.20 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    2.21 -*/
    2.22 -
    2.23 -#if !defined(_GNTTBL_PUBLIC_H_)
    2.24 -#define _GNTTBL_PUBLIC_H_
    2.25 -
    2.26 -// {6A71ACF8-0F6D-4022-BA60-19986EBEEA73}
    2.27 -DEFINE_GUID(GUID_XEN_IFACE_GNTTBL, 0x6a71acf8, 0xf6d, 0x4022, 0xba, 0x60, 0x19, 0x98, 0x6e, 0xbe, 0xea, 0x73);
    2.28 -
    2.29 -typedef grant_ref_t
    2.30 -(*PXEN_GNTTBL_GRANTACCESS)(WDFDEVICE Device, domid_t domid, unsigned long frame, int readonly);
    2.31 -typedef BOOLEAN
    2.32 -(*PXEN_GNTTBL_ENDACCESS)(WDFDEVICE Device, grant_ref_t ref);
    2.33 -
    2.34 -typedef struct _XEN_IFACE_GNTTBL {
    2.35 -  INTERFACE InterfaceHeader;
    2.36 -
    2.37 -  PXEN_GNTTBL_GRANTACCESS GrantAccess;
    2.38 -  PXEN_GNTTBL_ENDACCESS EndAccess;
    2.39 -} XEN_IFACE_GNTTBL, *PXEN_IFACE_GNTTBL;
    2.40 -
    2.41 -#endif
    2.42 \ No newline at end of file
     3.1 --- a/common/include/xen_public.h	Thu Dec 20 21:37:20 2007 +1100
     3.2 +++ b/common/include/xen_public.h	Thu Dec 27 20:49:42 2007 +1100
     3.3 @@ -1,38 +1,131 @@
     3.4 +/*
     3.5 +PV Drivers for Windows Xen HVM Domains
     3.6 +Copyright (C) 2007 James Harper
     3.7 +
     3.8 +This program is free software; you can redistribute it and/or
     3.9 +modify it under the terms of the GNU General Public License
    3.10 +as published by the Free Software Foundation; either version 2
    3.11 +of the License, or (at your option) any later version.
    3.12 +
    3.13 +This program is distributed in the hope that it will be useful,
    3.14 +but WITHOUT ANY WARRANTY; without even the implied warranty of
    3.15 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    3.16 +GNU General Public License for more details.
    3.17 +
    3.18 +You should have received a copy of the GNU General Public License
    3.19 +along with this program; if not, write to the Free Software
    3.20 +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    3.21 +*/
    3.22 +
    3.23  #if !defined(_XEN_PUBLIC_H_)
    3.24  #define _XEN_PUBLIC_H_
    3.25  
    3.26 -#include <evtchn_public.h>
    3.27 -#include <xenbus_public.h>
    3.28 -#include <gnttbl_public.h>
    3.29 +//#include <evtchn_public.h>
    3.30 +//#include <xenbus_public.h>
    3.31 +//#include <gnttbl_public.h>
    3.32  
    3.33 -DEFINE_GUID( GUID_XEN_IFACE_XEN, 0x5C568AC5, 0x9DDF, 0x4FA5, 0xA9, 0x4A, 0x39, 0xD6, 0x70, 0x77, 0x81, 0x9C);
    3.34 +DEFINE_GUID( GUID_XEN_IFACE, 0x5C568AC5, 0x9DDF, 0x4FA5, 0xA9, 0x4A, 0x39, 0xD6, 0x70, 0x77, 0x81, 0x9C);
    3.35  //{5C568AC5-9DDF-4FA5-A94A-39D67077819C}
    3.36  
    3.37  typedef PHYSICAL_ADDRESS
    3.38  (*PXEN_ALLOCMMIO)(ULONG Length);
    3.39  
    3.40 +typedef NTSTATUS
    3.41 +(*PXEN_EVTCHN_BIND)(PVOID Context, evtchn_port_t Port, PKSERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext);
    3.42  
    3.43 -typedef struct _XEN_IFACE_XEN {
    3.44 +typedef NTSTATUS
    3.45 +(*PXEN_EVTCHN_UNBIND)(PVOID Context, evtchn_port_t Port);
    3.46 +
    3.47 +typedef NTSTATUS
    3.48 +(*PXEN_EVTCHN_MASK)(PVOID Context, evtchn_port_t Port);
    3.49 +
    3.50 +typedef NTSTATUS
    3.51 +(*PXEN_EVTCHN_UNMASK)(PVOID Context, evtchn_port_t Port);
    3.52 +
    3.53 +typedef NTSTATUS
    3.54 +(*PXEN_EVTCHN_NOTIFY)(PVOID Context, evtchn_port_t Port);
    3.55 +
    3.56 +typedef evtchn_port_t
    3.57 +(*PXEN_EVTCHN_ALLOCUNBOUND)(PVOID Context, domid_t Domain);
    3.58 +
    3.59 +typedef grant_ref_t
    3.60 +(*PXEN_GNTTBL_GRANTACCESS)(WDFDEVICE Device, domid_t domid, unsigned long frame, int readonly);
    3.61 +typedef BOOLEAN
    3.62 +(*PXEN_GNTTBL_ENDACCESS)(WDFDEVICE Device, grant_ref_t ref);
    3.63 +
    3.64 +typedef VOID
    3.65 +(*PXENBUS_WATCH_CALLBACK)(char *Path, PVOID ServiceContext);
    3.66 +
    3.67 +typedef char *
    3.68 +(*PXEN_XENBUS_READ)(PVOID Context, xenbus_transaction_t xbt, const char *path, char **value);
    3.69 +
    3.70 +typedef char *
    3.71 +(*PXEN_XENBUS_WRITE)(PVOID Context, xenbus_transaction_t xbt, const char *path, const char *value);
    3.72 +
    3.73 +typedef char *
    3.74 +(*PXEN_XENBUS_PRINTF)(PVOID Context, xenbus_transaction_t xbt, const char *path, const char *fmt, ...);
    3.75 +
    3.76 +typedef char *
    3.77 +(*PXEN_XENBUS_STARTTRANSACTION)(PVOID Context, xenbus_transaction_t *xbt);
    3.78 +
    3.79 +typedef char *
    3.80 +(*PXEN_XENBUS_ENDTRANSACTION)(PVOID Context, xenbus_transaction_t t, int abort, int *retry);
    3.81 +
    3.82 +typedef char *
    3.83 +(*PXEN_XENBUS_LIST)(PVOID Context, xenbus_transaction_t xbt, const char *prefix, char ***contents);
    3.84 +
    3.85 +typedef char *
    3.86 +(*PXEN_XENBUS_ADDWATCH)(PVOID Context, xenbus_transaction_t xbt, const char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
    3.87 +
    3.88 +typedef char *
    3.89 +(*PXEN_XENBUS_REMWATCH)(PVOID Context, xenbus_transaction_t xbt, const char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
    3.90 +
    3.91 +typedef struct _XEN_IFACE {
    3.92    INTERFACE InterfaceHeader;
    3.93  
    3.94 -  // hypervisor calls
    3.95    PXEN_ALLOCMMIO AllocMMIO;
    3.96 -  // allocate a page from the mmio space
    3.97 -  // release a page from the mmio space
    3.98  
    3.99 -} XEN_IFACE_XEN, *PXEN_IFACE_XEN;
   3.100 +  PXEN_EVTCHN_BIND EvtChn_Bind;
   3.101 +  PXEN_EVTCHN_UNBIND EvtChn_Unbind;
   3.102 +  PXEN_EVTCHN_MASK EvtChn_Mask;
   3.103 +  PXEN_EVTCHN_UNMASK EvtChn_Unmask;
   3.104 +  PXEN_EVTCHN_NOTIFY EvtChn_Notify;
   3.105 +  PXEN_EVTCHN_ALLOCUNBOUND EvtChn_AllocUnbound;
   3.106 +  PXEN_EVTCHN_BIND EvtChn_BindDpc;
   3.107 +
   3.108 +  PXEN_GNTTBL_GRANTACCESS GntTbl_GrantAccess;
   3.109 +  PXEN_GNTTBL_ENDACCESS GntTbl_EndAccess;
   3.110 +
   3.111 +  PXEN_XENBUS_READ XenBus_Read;
   3.112 +  PXEN_XENBUS_WRITE XenBus_Write;
   3.113 +  PXEN_XENBUS_PRINTF XenBus_Printf;
   3.114 +  PXEN_XENBUS_STARTTRANSACTION XenBus_StartTransaction;
   3.115 +  PXEN_XENBUS_ENDTRANSACTION XenBus_EndTransaction;
   3.116 +  PXEN_XENBUS_LIST XenBus_List;
   3.117 +  PXEN_XENBUS_ADDWATCH XenBus_AddWatch;
   3.118 +  PXEN_XENBUS_REMWATCH XenBus_RemWatch;
   3.119 +
   3.120 +} XEN_IFACE, *PXEN_IFACE;
   3.121  
   3.122  #define XEN_DATA_MAGIC 0x12345678
   3.123  
   3.124 +typedef struct _XENPCI_IDENTIFICATION_DESCRIPTION
   3.125 +{
   3.126 +  WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header;
   3.127 +  UNICODE_STRING DeviceType;
   3.128 +  ULONG DeviceIndex;
   3.129 +  char Path[128];
   3.130 +} XENPCI_IDENTIFICATION_DESCRIPTION, *PXENPCI_IDENTIFICATION_DESCRIPTION;
   3.131 +
   3.132  typedef struct {
   3.133    ULONG Magic;
   3.134    char BasePath[128];
   3.135    PXENBUS_WATCH_CALLBACK WatchHandler;
   3.136    PVOID WatchContext;
   3.137 -  XEN_IFACE_EVTCHN EvtChnInterface;
   3.138 -  XEN_IFACE_XENBUS XenBusInterface;
   3.139 -  //XEN_IFACE_XEN XenInterface;
   3.140 -  XEN_IFACE_GNTTBL GntTblInterface;
   3.141 +  //XEN_IFACE_EVTCHN EvtChnInterface;
   3.142 +//  XEN_IFACE_XENBUS XenBusInterface;
   3.143 +  XEN_IFACE XenInterface;
   3.144 +//  XEN_IFACE_GNTTBL GntTblInterface;
   3.145    BOOLEAN AutoEnumerate;
   3.146    CM_PARTIAL_RESOURCE_DESCRIPTOR InterruptRaw;
   3.147    CM_PARTIAL_RESOURCE_DESCRIPTOR InterruptTranslated;
   3.148 @@ -40,4 +133,4 @@ typedef struct {
   3.149  
   3.150  WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(XENPCI_XEN_DEVICE_DATA, GetXenDeviceData);
   3.151  
   3.152 -#endif
   3.153 \ No newline at end of file
   3.154 +#endif
     4.1 --- a/common/include/xenbus_public.h	Thu Dec 20 21:37:20 2007 +1100
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,59 +0,0 @@
     4.4 -/*
     4.5 -PV Drivers for Windows Xen HVM Domains
     4.6 -Copyright (C) 2007 James Harper
     4.7 -
     4.8 -This program is free software; you can redistribute it and/or
     4.9 -modify it under the terms of the GNU General Public License
    4.10 -as published by the Free Software Foundation; either version 2
    4.11 -of the License, or (at your option) any later version.
    4.12 -
    4.13 -This program is distributed in the hope that it will be useful,
    4.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    4.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    4.16 -GNU General Public License for more details.
    4.17 -
    4.18 -You should have received a copy of the GNU General Public License
    4.19 -along with this program; if not, write to the Free Software
    4.20 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    4.21 -*/
    4.22 -
    4.23 -#if !defined(_XENBUS_PUBLIC_H_)
    4.24 -#define _XENBUS_PUBLIC_H_
    4.25 -
    4.26 -DEFINE_GUID( GUID_XEN_IFACE_XENBUS, 0x9CA4D816, 0x0E5E, 0x4f9a, 0x8F, 0x59, 0x94, 0x4C, 0xED, 0x82, 0x78, 0x11);
    4.27 -//{9CA4D816-0E5E-4f9a-8F59-944CED827811}
    4.28 -
    4.29 -typedef VOID
    4.30 -(*PXENBUS_WATCH_CALLBACK)(char *Path, PVOID ServiceContext);
    4.31 -
    4.32 -typedef char *
    4.33 -(*PXEN_XENBUS_READ)(PVOID Context, xenbus_transaction_t xbt, const char *path, char **value);
    4.34 -typedef char *
    4.35 -(*PXEN_XENBUS_WRITE)(PVOID Context, xenbus_transaction_t xbt, const char *path, const char *value);
    4.36 -typedef char *
    4.37 -(*PXEN_XENBUS_PRINTF)(PVOID Context, xenbus_transaction_t xbt, const char *path, const char *fmt, ...);
    4.38 -typedef char *
    4.39 -(*PXEN_XENBUS_STARTTRANSACTION)(PVOID Context, xenbus_transaction_t *xbt);
    4.40 -typedef char *
    4.41 -(*PXEN_XENBUS_ENDTRANSACTION)(PVOID Context, xenbus_transaction_t t, int abort, int *retry);
    4.42 -typedef char *
    4.43 -(*PXEN_XENBUS_LIST)(PVOID Context, xenbus_transaction_t xbt, const char *prefix, char ***contents);
    4.44 -typedef char *
    4.45 -(*PXEN_XENBUS_ADDWATCH)(PVOID Context, xenbus_transaction_t xbt, const char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
    4.46 -typedef char *
    4.47 -(*PXEN_XENBUS_REMWATCH)(PVOID Context, xenbus_transaction_t xbt, const char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
    4.48 -
    4.49 -typedef struct _XEN_IFACE_XENBUS {
    4.50 -  INTERFACE InterfaceHeader;
    4.51 -
    4.52 -  PXEN_XENBUS_READ Read;
    4.53 -  PXEN_XENBUS_WRITE Write;
    4.54 -  PXEN_XENBUS_PRINTF Printf;
    4.55 -  PXEN_XENBUS_STARTTRANSACTION StartTransaction;
    4.56 -  PXEN_XENBUS_ENDTRANSACTION EndTransaction;
    4.57 -  PXEN_XENBUS_LIST List;
    4.58 -  PXEN_XENBUS_ADDWATCH AddWatch;
    4.59 -  PXEN_XENBUS_REMWATCH RemWatch;
    4.60 -} XEN_IFACE_XENBUS, *PXEN_IFACE_XENBUS;
    4.61 -
    4.62 -#endif
    4.63 \ No newline at end of file
     5.1 --- a/dirs	Thu Dec 20 21:37:20 2007 +1100
     5.2 +++ b/dirs	Thu Dec 27 20:49:42 2007 +1100
     5.3 @@ -1,1 +1,1 @@
     5.4 -DIRS=xenpci xenhide xenvbd xenaddresource xennet
     5.5 \ No newline at end of file
     5.6 +DIRS=xenpci xenhide xenvbd xenaddresource xenenum xennet
     5.7 \ No newline at end of file
     6.1 --- a/xenaddresource/sources	Thu Dec 20 21:37:20 2007 +1100
     6.2 +++ b/xenaddresource/sources	Thu Dec 27 20:49:42 2007 +1100
     6.3 @@ -1,7 +1,7 @@
     6.4  TARGETNAME=XENADDRESOURCE
     6.5  TARGETTYPE=DRIVER
     6.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     6.7 -VERSION=0.4.0.0
     6.8 +VERSION=0.5.0.1
     6.9  KMDF_VERSION=1
    6.10  MSC_WARNING_LEVEL=/W4
    6.11  #INF_NAME=xenaddresource
     7.1 --- a/xenaddresource/xenaddresource.h	Thu Dec 20 21:37:20 2007 +1100
     7.2 +++ b/xenaddresource/xenaddresource.h	Thu Dec 27 20:49:42 2007 +1100
     7.3 @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fi
     7.4  #define NTSTRSAFE_LIB
     7.5  #include <ntstrsafe.h>
     7.6  
     7.7 +#define __DRIVER_NAME "XenAddResource"
     7.8  #include <xen_windows.h>
     7.9  
    7.10  #include <memory.h>
    7.11 @@ -39,12 +40,8 @@ Foundation, Inc., 51 Franklin Street, Fi
    7.12  #include <event_channel.h>
    7.13  #include <hvm/params.h>
    7.14  #include <hvm/hvm_op.h>
    7.15 -#include <evtchn_public.h>
    7.16 -#include <xenbus_public.h>
    7.17  #include <xen_public.h>
    7.18 -#include <gnttbl_public.h>
    7.19  
    7.20 -#define __DRIVER_NAME "XenAddResource"
    7.21  #define XENADDRESOURCE_POOL_TAG (ULONG) 'XenR'
    7.22  
    7.23  #define NR_RESERVED_ENTRIES 8
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/xenenum/makefile	Thu Dec 27 20:49:42 2007 +1100
     8.3 @@ -0,0 +1,1 @@
     8.4 +!INCLUDE $(NTMAKEENV)\makefile.def
     8.5 \ No newline at end of file
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/xenenum/makefile.inc	Thu Dec 27 20:49:42 2007 +1100
     9.3 @@ -0,0 +1,6 @@
     9.4 +_LNG=$(LANGUAGE)
     9.5 +STAMP=stampinf -f $@ -a $(_BUILDARCH) -d * -v $(VERSION)
     9.6 +
     9.7 +..\Target\$(DDK_TARGET_OS)\$(INF_NAME).inf: $(INF_NAME).inx sources
     9.8 +    copy $(@B).inx $@
     9.9 +    $(STAMP)
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/xenenum/sources	Thu Dec 27 20:49:42 2007 +1100
    10.3 @@ -0,0 +1,13 @@
    10.4 +TARGETNAME=xenenum
    10.5 +TARGETTYPE=DRIVER
    10.6 +TARGETPATH=..\Target\$(DDK_TARGET_OS)
    10.7 +VERSION=0.5.0.10
    10.8 +KMDF_VERSION=1
    10.9 +MSC_WARNING_LEVEL=/W4
   10.10 +INF_NAME=xenenum
   10.11 +INCLUDES = ..\common\include;..\common\include\public
   10.12 +TARGETLIBS=$(DDK_LIB_PATH)\ntstrsafe.lib
   10.13 +MISCFILES=..\Target\$(DDK_TARGET_OS)\$(INF_NAME).inf
   10.14 +NTTARGETFILES=
   10.15 +SOURCES=xenenum.c
   10.16 +
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/xenenum/xenenum.c	Thu Dec 27 20:49:42 2007 +1100
    11.3 @@ -0,0 +1,572 @@
    11.4 +#include "xenenum.h"
    11.5 +#include <io/blkif.h>
    11.6 +#include <srb.h>
    11.7 +#include <scsi.h>
    11.8 +#include <ntddscsi.h>
    11.9 +#include <ntdddisk.h>
   11.10 +#include <stdlib.h>
   11.11 +#include <xen_public.h>
   11.12 +#include <io/xenbus.h>
   11.13 +#include <ntddft.h>
   11.14 +
   11.15 +#define wmb() KeMemoryBarrier()
   11.16 +#define mb() KeMemoryBarrier()
   11.17 +
   11.18 +DRIVER_INITIALIZE DriverEntry;
   11.19 +
   11.20 +static NTSTATUS
   11.21 +XenEnum_AddDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit);
   11.22 +static NTSTATUS
   11.23 +XenEnum_PrepareHardware(WDFDEVICE hDevice, WDFCMRESLIST Resources, WDFCMRESLIST ResourcesTranslated);
   11.24 +static NTSTATUS
   11.25 +XenEnum_ReleaseHardware(WDFDEVICE Device, WDFCMRESLIST ResourcesTranslated);
   11.26 +static NTSTATUS
   11.27 +XenEnum_D0Entry(WDFDEVICE Device, WDF_POWER_DEVICE_STATE PreviousState);
   11.28 +static NTSTATUS
   11.29 +XenEnum_D0EntryPostInterruptsEnabled(WDFDEVICE Device, WDF_POWER_DEVICE_STATE PreviousState);
   11.30 +static NTSTATUS
   11.31 +XenEnum_D0Exit(WDFDEVICE Device, WDF_POWER_DEVICE_STATE TargetState);
   11.32 +static NTSTATUS
   11.33 +XenEnum_DeviceUsageNotification(WDFDEVICE Device, WDF_SPECIAL_FILE_TYPE NotificationType, BOOLEAN IsInNotificationPath);
   11.34 +
   11.35 +static NTSTATUS
   11.36 +XenEnum_ChildListCreateDevice(WDFCHILDLIST ChildList, PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, PWDFDEVICE_INIT ChildInit);
   11.37 +
   11.38 +static VOID
   11.39 +XenEnum_WatchHandler(char *Path, PVOID Data);
   11.40 +
   11.41 +#ifdef ALLOC_PRAGMA
   11.42 +#pragma alloc_text (INIT, DriverEntry)
   11.43 +#pragma alloc_text (PAGE, XenEnum_AddDevice)
   11.44 +#endif
   11.45 +
   11.46 +LIST_ENTRY DeviceListHead;
   11.47 +//XEN_IFACE_EVTCHN EvtChnInterface;
   11.48 +//XEN_IFACE_XENBUS XenBusInterface;
   11.49 +XEN_IFACE XenInterface;
   11.50 +//XEN_IFACE_GNTTBL GntTblInterface;
   11.51 +
   11.52 +static BOOLEAN AutoEnumerate;
   11.53 +
   11.54 +NTSTATUS
   11.55 +DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
   11.56 +{
   11.57 +  WDF_DRIVER_CONFIG config;
   11.58 +  ULONG status;
   11.59 +  UNICODE_STRING RegKeyName;
   11.60 +  UNICODE_STRING RegValueName;
   11.61 +  HANDLE RegHandle;
   11.62 +  OBJECT_ATTRIBUTES RegObjectAttributes;
   11.63 +  char Buf[200];
   11.64 +  ULONG BufLen = 200;
   11.65 +  PKEY_VALUE_PARTIAL_INFORMATION KeyPartialValue;
   11.66 +  int State = 0;
   11.67 +  int StartPos = 0;
   11.68 +  WCHAR *SystemStartOptions;
   11.69 +  size_t SystemStartOptionsLen;
   11.70 +  size_t i;
   11.71 +
   11.72 +  KdPrint((__DRIVER_NAME " --> DriverEntry\n"));
   11.73 +
   11.74 +  WDF_DRIVER_CONFIG_INIT(&config, XenEnum_AddDevice);
   11.75 +  status = WdfDriverCreate(
   11.76 +                      DriverObject,
   11.77 +                      RegistryPath,
   11.78 +                      WDF_NO_OBJECT_ATTRIBUTES,
   11.79 +                      &config,
   11.80 +                      WDF_NO_HANDLE);
   11.81 +  if(!NT_SUCCESS(status))
   11.82 +  {
   11.83 +    KdPrint((__DRIVER_NAME " WdfDriverCreate failed with status 0x%08x\n", status));
   11.84 +  }
   11.85 +
   11.86 +  RtlInitUnicodeString(&RegKeyName, L"\\Registry\\Machine\\System\\CurrentControlSet\\Control");
   11.87 +  InitializeObjectAttributes(&RegObjectAttributes, &RegKeyName, OBJ_CASE_INSENSITIVE, NULL, NULL);
   11.88 +  status = ZwOpenKey(&RegHandle, KEY_READ, &RegObjectAttributes);
   11.89 +  if(!NT_SUCCESS(status))
   11.90 +  {
   11.91 +    KdPrint((__DRIVER_NAME "     ZwOpenKey returned %08x\n", status));
   11.92 +  }
   11.93 +
   11.94 +  RtlInitUnicodeString(&RegValueName, L"SystemStartOptions");
   11.95 +  status = ZwQueryValueKey(RegHandle, &RegValueName, KeyValuePartialInformation, Buf, BufLen, &BufLen);
   11.96 +  if(!NT_SUCCESS(status))
   11.97 +  {
   11.98 +    KdPrint((__DRIVER_NAME "     ZwQueryKeyValue returned %08x\n", status));
   11.99 +  }
  11.100 +  //KdPrint((__DRIVER_NAME "     BufLen = %d\n", BufLen));
  11.101 +  KeyPartialValue = (PKEY_VALUE_PARTIAL_INFORMATION)Buf;
  11.102 +  KdPrint((__DRIVER_NAME "     Buf = %ws\n", KeyPartialValue->Data));
  11.103 +  SystemStartOptions = (WCHAR *)KeyPartialValue->Data;
  11.104 +
  11.105 +  AutoEnumerate = FALSE;
  11.106 +
  11.107 +  RtlStringCbLengthW(SystemStartOptions, KeyPartialValue->DataLength, &SystemStartOptionsLen);
  11.108 +
  11.109 +  for (i = 0; i <= SystemStartOptionsLen/2; i++)
  11.110 +  {
  11.111 +    //KdPrint((__DRIVER_NAME "     pos = %d, state = %d, char = '%wc' (%d)\n", i, State, SystemStartOptions[i], SystemStartOptions[i]));
  11.112 +    
  11.113 +    switch (State)
  11.114 +    {
  11.115 +    case 0:
  11.116 +      if (SystemStartOptions[i] == L'G')
  11.117 +      {
  11.118 +        StartPos = i;
  11.119 +        State = 2;
  11.120 +      } else if (SystemStartOptions[i] != L' ')
  11.121 +      {
  11.122 +        State = 1;
  11.123 +      }
  11.124 +      break;
  11.125 +    case 1:
  11.126 +      if (SystemStartOptions[i] == L' ')
  11.127 +        State = 0;
  11.128 +      break;
  11.129 +    case 2:
  11.130 +      if (SystemStartOptions[i] == L'P')
  11.131 +        State = 3;
  11.132 +      else
  11.133 +        State = 0;
  11.134 +      break;
  11.135 +    case 3:
  11.136 +      if (SystemStartOptions[i] == L'L')
  11.137 +        State = 4;
  11.138 +      else
  11.139 +        State = 0;
  11.140 +      break;
  11.141 +    case 4:
  11.142 +      if (SystemStartOptions[i] == L'P')
  11.143 +        State = 5;
  11.144 +      else
  11.145 +        State = 0;
  11.146 +      break;
  11.147 +    case 5:
  11.148 +      if (SystemStartOptions[i] == L'V')
  11.149 +        State = 6;
  11.150 +      else
  11.151 +        State = 0;
  11.152 +      break;
  11.153 +    case 6:
  11.154 +      if (SystemStartOptions[i] == L' ' || SystemStartOptions[i] == 0)
  11.155 +        AutoEnumerate = TRUE;
  11.156 +      State = 0;
  11.157 +      break;
  11.158 +    }
  11.159 +  }
  11.160 +
  11.161 +  KdPrint((__DRIVER_NAME "     AutoEnumerate = %d\n", AutoEnumerate));
  11.162 +
  11.163 +  KdPrint((__DRIVER_NAME " <-- DriverEntry\n"));
  11.164 +
  11.165 +  return status;
  11.166 +}
  11.167 +
  11.168 +DEFINE_GUID( GUID_XENPCI_DEVCLASS, 0xC828ABE9, 0x14CA, 0x4445, 0xBA, 0xA6, 0x82, 0xC2, 0x37, 0x6C, 0x65, 0x18);
  11.169 +
  11.170 +static WDFDEVICE GlobalDevice;
  11.171 +static PDEVICE_OBJECT Pdo;
  11.172 +
  11.173 +static NTSTATUS
  11.174 +XenEnum_AddDevice(WDFDRIVER Driver, PWDFDEVICE_INIT DeviceInit)
  11.175 +{
  11.176 +  WDF_CHILD_LIST_CONFIG ChildListConfig;
  11.177 +  NTSTATUS status;
  11.178 +  WDF_PNPPOWER_EVENT_CALLBACKS pnpPowerCallbacks;
  11.179 +  PNP_BUS_INFORMATION BusInfo;
  11.180 +  
  11.181 +  UNREFERENCED_PARAMETER(Driver);
  11.182 +
  11.183 +  KdPrint((__DRIVER_NAME " --> DeviceAdd\n"));
  11.184 +
  11.185 +  Pdo = WdfFdoInitWdmGetPhysicalDevice(DeviceInit);
  11.186 +
  11.187 +  WdfDeviceInitSetDeviceType(DeviceInit, FILE_DEVICE_BUS_EXTENDER);
  11.188 +  WDF_CHILD_LIST_CONFIG_INIT(&ChildListConfig, sizeof(XENPCI_IDENTIFICATION_DESCRIPTION), XenEnum_ChildListCreateDevice);
  11.189 +  WdfFdoInitSetDefaultChildListConfig(DeviceInit, &ChildListConfig, WDF_NO_OBJECT_ATTRIBUTES);
  11.190 +  WdfDeviceInitSetExclusive(DeviceInit, FALSE);
  11.191 +
  11.192 +  WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&pnpPowerCallbacks);
  11.193 +  pnpPowerCallbacks.EvtDevicePrepareHardware = XenEnum_PrepareHardware;
  11.194 +  pnpPowerCallbacks.EvtDeviceReleaseHardware = XenEnum_ReleaseHardware;
  11.195 +  pnpPowerCallbacks.EvtDeviceD0Entry = XenEnum_D0Entry;
  11.196 +  pnpPowerCallbacks.EvtDeviceD0EntryPostInterruptsEnabled = XenEnum_D0EntryPostInterruptsEnabled;
  11.197 +  pnpPowerCallbacks.EvtDeviceD0Exit = XenEnum_D0Exit;
  11.198 +  pnpPowerCallbacks.EvtDeviceUsageNotification = XenEnum_DeviceUsageNotification;
  11.199 +  WdfDeviceInitSetPnpPowerEventCallbacks(DeviceInit, &pnpPowerCallbacks);
  11.200 +
  11.201 +  /*create a device instance.*/
  11.202 +  status = WdfDeviceCreate(&DeviceInit, WDF_NO_OBJECT_ATTRIBUTES, &GlobalDevice);  
  11.203 +  if(!NT_SUCCESS(status))
  11.204 +  {
  11.205 +    KdPrint((__DRIVER_NAME "WdfDeviceCreate failed with status 0x%08x\n", status));
  11.206 +    return status;
  11.207 +  }
  11.208 +
  11.209 +  BusInfo.BusTypeGuid = GUID_XENPCI_DEVCLASS;
  11.210 +  BusInfo.LegacyBusType = Internal;
  11.211 +  BusInfo.BusNumber = 0;
  11.212 +
  11.213 +  WdfDeviceSetBusInformationForChildren(GlobalDevice, &BusInfo);
  11.214 +
  11.215 +/*
  11.216 +  WdfDeviceSetSpecialFileSupport(GlobalDevice, WdfSpecialFilePaging, TRUE);
  11.217 +  WdfDeviceSetSpecialFileSupport(GlobalDevice, WdfSpecialFileHibernation, TRUE);
  11.218 +  WdfDeviceSetSpecialFileSupport(GlobalDevice, WdfSpecialFileDump, TRUE);
  11.219 +*/
  11.220 +
  11.221 +  status = STATUS_SUCCESS;
  11.222 +
  11.223 +  KdPrint((__DRIVER_NAME " <-- DeviceAdd\n"));
  11.224 +  return status;
  11.225 +}
  11.226 +
  11.227 +static NTSTATUS
  11.228 +XenEnum_PrepareHardware(
  11.229 +  IN WDFDEVICE    Device,
  11.230 +  IN WDFCMRESLIST ResourceList,
  11.231 +  IN WDFCMRESLIST ResourceListTranslated)
  11.232 +{
  11.233 +  NTSTATUS status = STATUS_SUCCESS;
  11.234 +
  11.235 +  UNREFERENCED_PARAMETER(ResourceList);
  11.236 +  UNREFERENCED_PARAMETER(ResourceListTranslated);
  11.237 +
  11.238 +  KdPrint((__DRIVER_NAME " --> EvtDevicePrepareHardware\n"));
  11.239 +
  11.240 +  status = WdfFdoQueryForInterface(Device, &GUID_XEN_IFACE, (PINTERFACE)&XenInterface, sizeof(XEN_IFACE), 1, NULL);
  11.241 +  if(!NT_SUCCESS(status))
  11.242 +  {
  11.243 +    KdPrint((__DRIVER_NAME "     WdfFdoQueryForInterface (EvtChn) failed with status 0x%08x\n", status));
  11.244 +  }
  11.245 +
  11.246 +  InitializeListHead(&DeviceListHead);
  11.247 +
  11.248 +  KdPrint((__DRIVER_NAME " <-- EvtDevicePrepareHardware\n"));
  11.249 +
  11.250 +  return status;
  11.251 +}
  11.252 +
  11.253 +static NTSTATUS
  11.254 +XenEnum_ReleaseHardware(WDFDEVICE Device, WDFCMRESLIST ResourcesTranslated)
  11.255 +{
  11.256 +  UNREFERENCED_PARAMETER(Device);
  11.257 +  UNREFERENCED_PARAMETER(ResourcesTranslated);
  11.258 +
  11.259 +  // release interfaces here...
  11.260 +
  11.261 +  return STATUS_SUCCESS;
  11.262 +}
  11.263 +
  11.264 +static NTSTATUS
  11.265 +XenEnum_D0Entry(
  11.266 +    IN WDFDEVICE  Device,
  11.267 +    IN WDF_POWER_DEVICE_STATE PreviousState
  11.268 +    )
  11.269 +{
  11.270 +  NTSTATUS status = STATUS_SUCCESS;
  11.271 +
  11.272 +  UNREFERENCED_PARAMETER(Device);
  11.273 +  UNREFERENCED_PARAMETER(PreviousState);
  11.274 +
  11.275 +  //KdPrint((__DRIVER_NAME " --> EvtDeviceD0Entry\n"));
  11.276 +
  11.277 +  //KdPrint((__DRIVER_NAME " <-- EvtDeviceD0Entry\n"));
  11.278 +
  11.279 +  return status;
  11.280 +}
  11.281 +
  11.282 +static int EnumeratedDevices;
  11.283 +static KEVENT WaitDevicesEvent;
  11.284 +
  11.285 +static NTSTATUS
  11.286 +XenEnum_D0EntryPostInterruptsEnabled(WDFDEVICE Device, WDF_POWER_DEVICE_STATE PreviousState)
  11.287 +{
  11.288 +  NTSTATUS status = STATUS_SUCCESS;
  11.289 +  PXENPCI_XEN_DEVICE_DATA PdoDeviceData;
  11.290 +  char **Devices;
  11.291 +  char *msg;
  11.292 +  char buffer[128];
  11.293 +  int i;
  11.294 +  LARGE_INTEGER WaitTimeout;
  11.295 +
  11.296 +  UNREFERENCED_PARAMETER(Device);
  11.297 +  UNREFERENCED_PARAMETER(PreviousState);
  11.298 +
  11.299 +  KdPrint((__DRIVER_NAME " --> EvtDeviceD0EntryPostInterruptsEnabled\n"));
  11.300 +
  11.301 +  PdoDeviceData = (PXENPCI_XEN_DEVICE_DATA)Pdo->DeviceExtension; //GetXenDeviceData(Device);
  11.302 +
  11.303 +  //KdPrint((__DRIVER_NAME "     BasePath = %s\n", PdoDeviceData->BasePath));
  11.304 +  PdoDeviceData->WatchHandler = XenEnum_WatchHandler;
  11.305 +  PdoDeviceData->WatchContext = Device;
  11.306 +
  11.307 +  EnumeratedDevices = 0;
  11.308 +  KeInitializeEvent(&WaitDevicesEvent, SynchronizationEvent, FALSE);  
  11.309 +
  11.310 +  // TODO: Should probably do this in an EvtChildListScanForChildren
  11.311 +  if (AutoEnumerate)
  11.312 +  {
  11.313 +    // TODO: Get the correct path from parent here...
  11.314 +    msg = XenInterface.XenBus_List(XenInterface.InterfaceHeader.Context, XBT_NIL, PdoDeviceData->BasePath, &Devices);
  11.315 +    if (!msg)
  11.316 +    {
  11.317 +      for (i = 0; Devices[i]; i++)
  11.318 +      {
  11.319 +        KdPrint((__DRIVER_NAME "     found existing device %s\n", Devices[i]));
  11.320 +        KdPrint((__DRIVER_NAME "     faking watch event for %s/%s", PdoDeviceData->BasePath, Devices[i]));
  11.321 +        RtlStringCbPrintfA(buffer, ARRAY_SIZE(buffer), "%s/%s", PdoDeviceData->BasePath, Devices[i]);
  11.322 +        XenEnum_WatchHandler(buffer, Device);
  11.323 +        //ExFreePoolWithTag(Devices[i], XENPCI_POOL_TAG);
  11.324 +      }
  11.325 +/*
  11.326 +      KdPrint((__DRIVER_NAME "     Waiting for devices to be enumerated\n"));
  11.327 +      while (EnumeratedDevices != i)
  11.328 +      {
  11.329 +        WaitTimeout.QuadPart = -600000000;
  11.330 +        if (KeWaitForSingleObject(&WaitDevicesEvent, Executive, KernelMode, FALSE, &WaitTimeout) == STATUS_TIMEOUT)
  11.331 +        {
  11.332 +          KdPrint((__DRIVER_NAME "     Wait timed out\n"));
  11.333 +          break;
  11.334 +        }
  11.335 +        KdPrint((__DRIVER_NAME "     %d out of %d devices enumerated\n", EnumeratedDevices, i));
  11.336 +      }  
  11.337 +*/
  11.338 +    }
  11.339 +  }
  11.340 +
  11.341 +  KdPrint((__DRIVER_NAME " <-- EvtDeviceD0EntryPostInterruptsEnabled\n"));
  11.342 +
  11.343 +  return status;
  11.344 +}
  11.345 +
  11.346 +static NTSTATUS
  11.347 +XenEnum_D0Exit(
  11.348 +    IN WDFDEVICE Device,
  11.349 +    IN WDF_POWER_DEVICE_STATE  TargetState
  11.350 +    )
  11.351 +{
  11.352 +  NTSTATUS status = STATUS_SUCCESS;
  11.353 +  //char *response;
  11.354 +
  11.355 +  UNREFERENCED_PARAMETER(Device);
  11.356 +  UNREFERENCED_PARAMETER(TargetState);
  11.357 +
  11.358 +  //KdPrint((__DRIVER_NAME " --> EvtDeviceD0Exit\n"));
  11.359 +
  11.360 +  //response = XenBusInterface.RemWatch(XBT_NIL, XenBusInterface.InterfaceHeader.Context, XenEnum_WatchHandler, NULL);
  11.361 +
  11.362 +  //KdPrint((__DRIVER_NAME " <-- EvtDeviceD0Exit\n"));
  11.363 +
  11.364 +  return status;
  11.365 +}
  11.366 +
  11.367 +static NTSTATUS
  11.368 +XenEnum_DeviceUsageNotification(WDFDEVICE Device, WDF_SPECIAL_FILE_TYPE NotificationType, BOOLEAN IsInNotificationPath)
  11.369 +{
  11.370 +  KdPrint((__DRIVER_NAME " --> DeviceUsageNotification\n"));
  11.371 +
  11.372 +  switch (NotificationType)
  11.373 +  {
  11.374 +  case WdfSpecialFilePaging:
  11.375 +    KdPrint((__DRIVER_NAME "     NotificationType = WdfSpecialFilePaging, Using = %d\n", IsInNotificationPath));
  11.376 +    break;
  11.377 +  case WdfSpecialFileHibernation:
  11.378 +    KdPrint((__DRIVER_NAME "     NotificationType = WdfSpecialFileHibernation, Using = %d\n", IsInNotificationPath));
  11.379 +    break;
  11.380 +  case WdfSpecialFileDump:
  11.381 +    KdPrint((__DRIVER_NAME "     NotificationType = WdfSpecialFileDump, Using = %d\n", IsInNotificationPath));
  11.382 +    break;
  11.383 +  default:
  11.384 +    KdPrint((__DRIVER_NAME "     NotificationType = %d, Using = %d\n", NotificationType, IsInNotificationPath));
  11.385 +    break;
  11.386 +  }
  11.387 +  KdPrint((__DRIVER_NAME " <-- DeviceUsageNotification\n"));
  11.388 +
  11.389 +  return TRUE;
  11.390 +}
  11.391 +
  11.392 +static VOID 
  11.393 +XenEnum_IoDefault(
  11.394 +    IN WDFQUEUE  Queue,
  11.395 +    IN WDFREQUEST  Request
  11.396 +    )
  11.397 +{
  11.398 +  UNREFERENCED_PARAMETER(Queue);
  11.399 +
  11.400 +  //KdPrint((__DRIVER_NAME " --> EvtDeviceIoDefault\n"));
  11.401 +
  11.402 +  WdfRequestComplete(Request, STATUS_NOT_IMPLEMENTED);
  11.403 +
  11.404 +  //KdPrint((__DRIVER_NAME " <-- EvtDeviceIoDefault\n"));
  11.405 +}
  11.406 +
  11.407 +static VOID
  11.408 +XenEnum_WatchHandler(char *Path, PVOID Data)
  11.409 +{
  11.410 +  NTSTATUS Status;
  11.411 +  XENPCI_IDENTIFICATION_DESCRIPTION IdentificationDescription;
  11.412 +  char **Bits;
  11.413 +  int Count;
  11.414 +  char TmpPath[128];
  11.415 +  char *Value;
  11.416 +  ANSI_STRING AnsiBuf;
  11.417 +  WDFCHILDLIST ChildList;
  11.418 +  WDFDEVICE Device = Data;
  11.419 +  WDF_CHILD_LIST_ITERATOR ChildIterator;
  11.420 +  WDFDEVICE ChildDevice;
  11.421 +  PXENPCI_XEN_DEVICE_DATA ChildDeviceData;
  11.422 +
  11.423 +  UNREFERENCED_PARAMETER(Data);  
  11.424 +
  11.425 +  KdPrint((__DRIVER_NAME " --> WatchHandler\n"));
  11.426 +
  11.427 +  KdPrint((__DRIVER_NAME "     Path = %s\n", Path));
  11.428 +
  11.429 +  Bits = SplitString(Path, '/', 4, &Count);
  11.430 +  if (Count == 3)
  11.431 +  {
  11.432 +    KdPrint((__DRIVER_NAME "     Creating %s\n", Bits[2]));
  11.433 +    ChildList = WdfFdoGetDefaultChildList(Device);
  11.434 +    WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER_INIT(&IdentificationDescription.Header, sizeof(IdentificationDescription));
  11.435 +    strncpy(IdentificationDescription.Path, Path, 128);
  11.436 +    RtlInitAnsiString(&AnsiBuf, Bits[1]);
  11.437 +    RtlAnsiStringToUnicodeString(&IdentificationDescription.DeviceType, &AnsiBuf, TRUE);
  11.438 +    IdentificationDescription.DeviceIndex = atoi(Bits[2]);
  11.439 +    Status = WdfChildListAddOrUpdateChildDescriptionAsPresent(ChildList, &IdentificationDescription.Header, NULL);
  11.440 +  }
  11.441 +  else if (Count > 3)
  11.442 +  {
  11.443 +    WDF_CHILD_LIST_ITERATOR_INIT(&ChildIterator, WdfRetrievePresentChildren);
  11.444 +    ChildList = WdfFdoGetDefaultChildList(Device);
  11.445 +    WdfChildListBeginIteration(ChildList, &ChildIterator);
  11.446 +    while (NT_SUCCESS(WdfChildListRetrieveNextDevice(ChildList, &ChildIterator, &ChildDevice, NULL)))
  11.447 +    {
  11.448 +      ChildDeviceData = GetXenDeviceData(ChildDevice);
  11.449 +      if (!ChildDeviceData)
  11.450 +      {
  11.451 +        KdPrint((__FUNCTION__ " No child device data, should never happen\n"));
  11.452 +        continue;
  11.453 +      }
  11.454 +      if (strncmp(ChildDeviceData->BasePath, Path, strlen(ChildDeviceData->BasePath)) == 0 && Path[strlen(ChildDeviceData->BasePath)] == '/')
  11.455 +      {
  11.456 +        KdPrint((__DRIVER_NAME "     Child Path = %s (Match - WatchHandler = %08x)\n", ChildDeviceData->BasePath, ChildDeviceData->WatchHandler));
  11.457 +        if (ChildDeviceData->WatchHandler != NULL)
  11.458 +          ChildDeviceData->WatchHandler(Path, ChildDeviceData->WatchContext);
  11.459 +      }
  11.460 +      else
  11.461 +      {
  11.462 +        //KdPrint((__DRIVER_NAME "     Child Path = %s (No Match)\n", ChildDeviceData->BasePath));
  11.463 +      }
  11.464 +    }
  11.465 +    WdfChildListEndIteration(ChildList, &ChildIterator);
  11.466 +  }
  11.467 +  FreeSplitString(Bits, Count);
  11.468 +
  11.469 +  KdPrint((__DRIVER_NAME " <-- WatchHandler\n"));  
  11.470 +
  11.471 +  return;
  11.472 +}
  11.473 +
  11.474 +static NTSTATUS
  11.475 +XenEnum_ChildListCreateDevice(WDFCHILDLIST ChildList, PWDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER IdentificationDescription, PWDFDEVICE_INIT ChildInit)
  11.476 +{
  11.477 +  NTSTATUS status;
  11.478 +  WDFDEVICE ChildDevice;
  11.479 +  PXENPCI_IDENTIFICATION_DESCRIPTION XenIdentificationDesc;
  11.480 +  DECLARE_UNICODE_STRING_SIZE(buffer, 50);
  11.481 +  WDF_OBJECT_ATTRIBUTES PdoAttributes;
  11.482 +  DECLARE_CONST_UNICODE_STRING(DeviceLocation, L"Xen Bus");
  11.483 +  PXENPCI_XEN_DEVICE_DATA ChildDeviceData = NULL;
  11.484 +  WDF_QUERY_INTERFACE_CONFIG  qiConfig;
  11.485 +//  WDF_PDO_EVENT_CALLBACKS PdoCallbacks;
  11.486 +//  UCHAR PnpMinors[2] = { IRP_MN_START_DEVICE, IRP_MN_STOP_DEVICE };
  11.487 +
  11.488 +  UNREFERENCED_PARAMETER(ChildList);
  11.489 +
  11.490 +  KdPrint((__DRIVER_NAME " --> ChildListCreateDevice\n"));
  11.491 +
  11.492 +  XenIdentificationDesc = CONTAINING_RECORD(IdentificationDescription, XENPCI_IDENTIFICATION_DESCRIPTION, Header);
  11.493 +
  11.494 +//  ChildDeviceData = XenEnumIdentificationDesc->DeviceData;
  11.495 +
  11.496 +  WdfDeviceInitSetDeviceType(ChildInit, FILE_DEVICE_UNKNOWN);
  11.497 +
  11.498 +  status = RtlUnicodeStringPrintf(&buffer, L"XEN\\%wsdev\0", XenIdentificationDesc->DeviceType.Buffer);
  11.499 +
  11.500 +  KdPrint((__DRIVER_NAME "     %ws", buffer.Buffer));
  11.501 +
  11.502 +  status = WdfPdoInitAssignDeviceID(ChildInit, &buffer);
  11.503 +  status = WdfPdoInitAddCompatibleID(ChildInit, &buffer);
  11.504 +  status = WdfPdoInitAddHardwareID(ChildInit, &buffer);
  11.505 +
  11.506 +  status = RtlUnicodeStringPrintf(&buffer, L"%02d\0", XenIdentificationDesc->DeviceIndex);
  11.507 +  status = WdfPdoInitAssignInstanceID(ChildInit, &buffer);
  11.508 +
  11.509 +  status = RtlUnicodeStringPrintf(&buffer, L"Xen %ws Device (%d)", XenIdentificationDesc->DeviceType.Buffer, XenIdentificationDesc->DeviceIndex);
  11.510 +  status = WdfPdoInitAddDeviceText(ChildInit, &buffer, &DeviceLocation, 0x409);
  11.511 +  WdfPdoInitSetDefaultLocale(ChildInit, 0x409);
  11.512 +
  11.513 +  WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&PdoAttributes, XENPCI_XEN_DEVICE_DATA);
  11.514 +
  11.515 +  status = WdfDeviceCreate(&ChildInit, &PdoAttributes, &ChildDevice);
  11.516 +  if (!NT_SUCCESS(status))
  11.517 +  {
  11.518 +    KdPrint((__DRIVER_NAME "     WdfDeviceCreate status = %08X\n", status));
  11.519 +  }
  11.520 +
  11.521 +  WdfDeviceSetSpecialFileSupport(ChildDevice, WdfSpecialFilePaging, TRUE);
  11.522 +  WdfDeviceSetSpecialFileSupport(ChildDevice, WdfSpecialFileHibernation, TRUE);
  11.523 +  WdfDeviceSetSpecialFileSupport(ChildDevice, WdfSpecialFileDump, TRUE);
  11.524 +
  11.525 +  ChildDeviceData = GetXenDeviceData(ChildDevice);
  11.526 +  ChildDeviceData->Magic = XEN_DATA_MAGIC;
  11.527 +  ChildDeviceData->AutoEnumerate = AutoEnumerate;
  11.528 +  ChildDeviceData->WatchHandler = NULL;
  11.529 +  strncpy(ChildDeviceData->BasePath, XenIdentificationDesc->Path, 128);
  11.530 +//  memcpy(&ChildDeviceData->InterruptRaw, &InterruptRaw, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
  11.531 +//  memcpy(&ChildDeviceData->InterruptTranslated, &InterruptTranslated, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
  11.532 +  
  11.533 +  ChildDeviceData->XenInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->XenInterface);
  11.534 +  ChildDeviceData->XenInterface.InterfaceHeader.Version = 1;
  11.535 +  ChildDeviceData->XenInterface.InterfaceHeader.Context = XenInterface.InterfaceHeader.Context;
  11.536 +  ChildDeviceData->XenInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
  11.537 +  ChildDeviceData->XenInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
  11.538 +
  11.539 +  ChildDeviceData->XenInterface.AllocMMIO = XenInterface.AllocMMIO;
  11.540 +
  11.541 +  ChildDeviceData->XenInterface.EvtChn_Bind = XenInterface.EvtChn_Bind;
  11.542 +  ChildDeviceData->XenInterface.EvtChn_Unbind = XenInterface.EvtChn_Unbind;
  11.543 +  ChildDeviceData->XenInterface.EvtChn_Mask = XenInterface.EvtChn_Mask;
  11.544 +  ChildDeviceData->XenInterface.EvtChn_Unmask = XenInterface.EvtChn_Unmask;
  11.545 +  ChildDeviceData->XenInterface.EvtChn_Notify = XenInterface.EvtChn_Notify;
  11.546 +  ChildDeviceData->XenInterface.EvtChn_AllocUnbound = XenInterface.EvtChn_AllocUnbound;
  11.547 +  ChildDeviceData->XenInterface.EvtChn_BindDpc = XenInterface.EvtChn_BindDpc;
  11.548 +
  11.549 +  ChildDeviceData->XenInterface.GntTbl_GrantAccess = XenInterface.GntTbl_GrantAccess;
  11.550 +  ChildDeviceData->XenInterface.GntTbl_EndAccess = XenInterface.GntTbl_EndAccess;
  11.551 +
  11.552 +  ChildDeviceData->XenInterface.XenBus_Read = XenInterface.XenBus_Read;
  11.553 +  ChildDeviceData->XenInterface.XenBus_Write = XenInterface.XenBus_Write;
  11.554 +  ChildDeviceData->XenInterface.XenBus_Printf = XenInterface.XenBus_Printf;
  11.555 +  ChildDeviceData->XenInterface.XenBus_StartTransaction = XenInterface.XenBus_StartTransaction;
  11.556 +  ChildDeviceData->XenInterface.XenBus_EndTransaction = XenInterface.XenBus_EndTransaction;
  11.557 +  ChildDeviceData->XenInterface.XenBus_List = XenInterface.XenBus_List;
  11.558 +  ChildDeviceData->XenInterface.XenBus_AddWatch = XenInterface.XenBus_AddWatch;
  11.559 +  ChildDeviceData->XenInterface.XenBus_RemWatch = XenInterface.XenBus_RemWatch;
  11.560 +
  11.561 +  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE, NULL);
  11.562 +  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
  11.563 +  if (!NT_SUCCESS(status)) {
  11.564 +    return status;
  11.565 +  }
  11.566 +
  11.567 +
  11.568 +
  11.569 +
  11.570 +
  11.571 +
  11.572 +  KdPrint((__DRIVER_NAME " <-- ChildListCreateDevice (status = %08x)\n", status));
  11.573 +
  11.574 +  return status;
  11.575 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/xenenum/xenenum.h	Thu Dec 27 20:49:42 2007 +1100
    12.3 @@ -0,0 +1,48 @@
    12.4 +#if !defined(_XENENUM_H_)
    12.5 +#define _XENENUM_H_
    12.6 +
    12.7 +#include <ntddk.h>
    12.8 +#include <wdm.h>
    12.9 +#include <wdf.h>
   12.10 +#include <initguid.h>
   12.11 +#include <ntdddisk.h>
   12.12 +
   12.13 +#define NTSTRSAFE_LIB
   12.14 +#include <ntstrsafe.h>
   12.15 +
   12.16 +#define __DRIVER_NAME "XenEnum"
   12.17 +#include <xen_windows.h>
   12.18 +#include <memory.h>
   12.19 +#include <grant_table.h>
   12.20 +#include <event_channel.h>
   12.21 +#include <hvm/params.h>
   12.22 +#include <hvm/hvm_op.h>
   12.23 +#include <xen_public.h>
   12.24 +#include <io/ring.h>
   12.25 +#include <io/blkif.h>
   12.26 +#define XENENUM_POOL_TAG (ULONG) 'XENM'
   12.27 +
   12.28 +#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
   12.29 +#define BLK_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
   12.30 +
   12.31 +/*
   12.32 +struct
   12.33 +{
   12.34 +  LIST_ENTRY Entry;
   12.35 +  char Path[128];
   12.36 +  char BackendPath[128];
   12.37 +  ULONG DeviceIndex;
   12.38 +} typedef XENENUM_CHILD_DEVICE_DATA, *PXENENUM_CHILD_DEVICE_DATA, **PPXENENUM_CHILD_DEVICE_DATA;
   12.39 +
   12.40 +WDF_DECLARE_CONTEXT_TYPE_WITH_NAME(PXENENUM_CHILD_DEVICE_DATA, GetChildDeviceData);
   12.41 +
   12.42 +typedef struct _XENENUM_DEVICE_IDENTIFICATION_DESCRIPTION
   12.43 +{
   12.44 +  WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header;
   12.45 +  UNICODE_STRING DeviceType;
   12.46 +  ULONG DeviceIndex;
   12.47 +  char Path[128];
   12.48 +} XENENUM_DEVICE_IDENTIFICATION_DESCRIPTION, *PXENENUM_DEVICE_IDENTIFICATION_DESCRIPTION;
   12.49 +*/
   12.50 +
   12.51 +#endif
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/xenenum/xenenum.inx	Thu Dec 27 20:49:42 2007 +1100
    13.3 @@ -0,0 +1,69 @@
    13.4 +[Version]
    13.5 +Signature="$WINDOWS NT$"
    13.6 +Class=System
    13.7 +ClassGuid={4D36E97D-E325-11CE-BFC1-08002BE10318}
    13.8 +Provider=%JAMESHARPER%
    13.9 +
   13.10 +[DestinationDirs]
   13.11 +DefaultDestDir = 12
   13.12 +ClassInstall32_CopyFiles=11
   13.13 +CoInstaller_CopyFiles = 11
   13.14 +
   13.15 +[ControlFlags]
   13.16 +ExcludeFromSelect=*
   13.17 +
   13.18 +[Manufacturer]
   13.19 +%JAMESHARPER%=JAMESHARPER,NT$ARCH$
   13.20 +
   13.21 +[JAMESHARPER.NT$ARCH$]
   13.22 +%XenEnum.DRVDESC%=XenEnum_Inst, XEN\VIF
   13.23 +
   13.24 +[XenEnum_Inst.NT]
   13.25 +CopyFiles=XenEnum.CopyFiles
   13.26 +
   13.27 +[XenEnum.CopyFiles]
   13.28 +xenEnum.sys
   13.29 +
   13.30 +[XenEnum_Inst.NT.Services]
   13.31 +AddService=XenEnum,2,XenEnum_Service 
   13.32 +
   13.33 +[XenEnum_Service]
   13.34 +DisplayName    = %XenEnum.SVCDESC%                            
   13.35 +ServiceType    = 1
   13.36 +StartType      = 0
   13.37 +ErrorControl   = 1
   13.38 +LoadOrderGroup = WdfLoadGroup
   13.39 +ServiceBinary  = %12%\xenenum.sys                            
   13.40 +AddReg = XenEnum_Service_AddReg
   13.41 +
   13.42 +[XenEnum_Service_AddReg]
   13.43 +HKR,"Parameters\PnpInterface", "0", 0x00010001, 0x00000001
   13.44 +
   13.45 +[XenEnum_Inst.NT.CoInstallers]
   13.46 +AddReg=CoInstaller_AddReg
   13.47 +CopyFiles=CoInstaller_CopyFiles
   13.48 +
   13.49 +[XenEnum_Inst.NT.Wdf]
   13.50 +KmdfService = xenenum, xenenum_wdfsect
   13.51 +
   13.52 +[xenenum_wdfsect]
   13.53 +KmdfLibraryVersion = 1.0
   13.54 +
   13.55 +[SourceDisksFiles]
   13.56 +xenenum.sys=1
   13.57 +WdfCoinstaller01005.dll=1,,
   13.58 +
   13.59 +[SourceDisksNames]
   13.60 +1 = %DISK_NAME%,,,\i386
   13.61 +
   13.62 +[CoInstaller_CopyFiles]
   13.63 +WdfCoinstaller01005.dll,,,2
   13.64 +
   13.65 +[CoInstaller_AddReg]
   13.66 +HKR,,CoInstallers32,0x00010000, "WdfCoinstaller01005.dll,WdfCoInstaller"
   13.67 +
   13.68 +[Strings]
   13.69 +JAMESHARPER = "James Harper"
   13.70 +XenEnum.SVCDESC = "Xen Enum Device Driver"
   13.71 +XenEnum.DRVDESC = "Xen Enum Device Driver"
   13.72 +DISK_NAME = "Xen Enum Device Driver Install Disk"
    14.1 --- a/xenhide/sources	Thu Dec 20 21:37:20 2007 +1100
    14.2 +++ b/xenhide/sources	Thu Dec 27 20:49:42 2007 +1100
    14.3 @@ -1,7 +1,7 @@
    14.4  TARGETNAME=XENHIDE
    14.5  TARGETTYPE=DRIVER
    14.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
    14.7 -VERSION=0.5.0.0
    14.8 +VERSION=0.5.0.1
    14.9  KMDF_VERSION=1
   14.10  MSC_WARNING_LEVEL=/W4
   14.11  INF_NAME=xenhide
    15.1 --- a/xenhide/xenhide.h	Thu Dec 20 21:37:20 2007 +1100
    15.2 +++ b/xenhide/xenhide.h	Thu Dec 27 20:49:42 2007 +1100
    15.3 @@ -33,6 +33,8 @@ Foundation, Inc., 51 Franklin Street, Fi
    15.4  #define NTSTRSAFE_LIB
    15.5  #include <ntstrsafe.h>
    15.6  
    15.7 +#define __DRIVER_NAME "XenHide"
    15.8 +
    15.9  #include <xen_windows.h>
   15.10  
   15.11  #include <memory.h>
   15.12 @@ -44,7 +46,6 @@ Foundation, Inc., 51 Franklin Street, Fi
   15.13  //{C828ABE9-14CA-4445-BAA6-82C2376C6518}
   15.14  //DEFINE_GUID( GUID_XENPCI_DEVCLASS, 0xC828ABE9, 0x14CA, 0x4445, 0xBA, 0xA6, 0x82, 0xC2, 0x37, 0x6C, 0x65, 0x18);
   15.15  
   15.16 -#define __DRIVER_NAME "XenHide"
   15.17  #define XENHIDE_POOL_TAG (ULONG) 'XenH'
   15.18  //#define XENHIDE_FDO_INSTANCE_SIGNATURE (ULONG) 'XENP'
   15.19  
   15.20 @@ -96,10 +97,4 @@ typedef uint32_t XENSTORE_RING_IDX;
   15.21  
   15.22  #define XBT_NIL ((xenbus_transaction_t)0)
   15.23  
   15.24 -#include <evtchn_public.h>
   15.25 -#include <xenbus_public.h>
   15.26 -#include <xen_public.h>
   15.27 -#include <gnttbl_public.h>
   15.28 -
   15.29 -
   15.30  #endif
    16.1 --- a/xennet/xennet.c	Thu Dec 20 21:37:20 2007 +1100
    16.2 +++ b/xennet/xennet.c	Thu Dec 27 20:49:42 2007 +1100
    16.3 @@ -428,8 +428,7 @@ XenNet_BackEndStateHandler(char *Path, P
    16.4      /* TODO: must free pages in MDL as well as MDL using MmFreePagesFromMdl and ExFreePool */
    16.5      // or, allocate mem and then get mdl, then free mdl
    16.6      xi->tx_mdl = AllocatePage();
    16.7 -    xi->tx_pgs = MmMapLockedPagesSpecifyCache(xi->tx_mdl, KernelMode, MmNonCached,
    16.8 -      NULL, FALSE, NormalPagePriority);
    16.9 +    xi->tx_pgs = MmGetMdlVirtualAddress(xi->tx_mdl); //MmMapLockedPagesSpecifyCache(xi->tx_mdl, KernelMode, MmNonCached, NULL, FALSE, NormalPagePriority);
   16.10      SHARED_RING_INIT(xi->tx_pgs);
   16.11      FRONT_RING_INIT(&xi->tx, xi->tx_pgs, PAGE_SIZE);
   16.12      xi->tx_ring_ref = xi->GntTblInterface.GrantAccess(
   16.13 @@ -437,8 +436,7 @@ XenNet_BackEndStateHandler(char *Path, P
   16.14        *MmGetMdlPfnArray(xi->tx_mdl), FALSE);
   16.15  
   16.16      xi->rx_mdl = AllocatePage();
   16.17 -    xi->rx_pgs = MmMapLockedPagesSpecifyCache(xi->rx_mdl, KernelMode, MmNonCached,
   16.18 -      NULL, FALSE, NormalPagePriority);
   16.19 +    xi->rx_pgs = MmGetMdlVirtualAddress(xi->rx_mdl); //MmMapLockedPagesSpecifyCache(xi->rx_mdl, KernelMode, MmNonCached, NULL, FALSE, NormalPagePriority);
   16.20      SHARED_RING_INIT(xi->rx_pgs);
   16.21      FRONT_RING_INIT(&xi->rx, xi->rx_pgs, PAGE_SIZE);
   16.22      xi->rx_ring_ref = xi->GntTblInterface.GrantAccess(
    17.1 --- a/xennet/xennet.inx	Thu Dec 20 21:37:20 2007 +1100
    17.2 +++ b/xennet/xennet.inx	Thu Dec 27 20:49:42 2007 +1100
    17.3 @@ -32,10 +32,10 @@ ExcludeFromSelect=*
    17.4  %JAMESHARPER%=JAMESHARPER,NTx86
    17.5  
    17.6  [JAMESHARPER]
    17.7 -%XenNet.DRVDESC%=XenNet_Inst, XEN\VIF
    17.8 +%XenNet.DRVDESC%=XenNet_Inst, XEN\VIFDEV
    17.9  
   17.10  [JAMESHARPER.NTx86]
   17.11 -%XenNet.DRVDESC%=XenNet_Inst, XEN\VIF
   17.12 +%XenNet.DRVDESC%=XenNet_Inst, XEN\VIFDEV
   17.13  
   17.14  [XenNet_Inst.NT]
   17.15  CopyFiles=XenNet.CopyFiles
    18.1 --- a/xenpci/sources	Thu Dec 20 21:37:20 2007 +1100
    18.2 +++ b/xenpci/sources	Thu Dec 27 20:49:42 2007 +1100
    18.3 @@ -1,7 +1,7 @@
    18.4  TARGETNAME=XENPCI
    18.5  TARGETTYPE=DRIVER
    18.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
    18.7 -VERSION=0.5.0.0
    18.8 +VERSION=0.5.0.3
    18.9  KMDF_VERSION=1
   18.10  MSC_WARNING_LEVEL=/W4
   18.11  INF_NAME=xenpci
    19.1 --- a/xenpci/xenpci.c	Thu Dec 20 21:37:20 2007 +1100
    19.2 +++ b/xenpci/xenpci.c	Thu Dec 27 20:49:42 2007 +1100
    19.3 @@ -383,7 +383,7 @@ XenPCI_AddDevice(
    19.4      return Status;
    19.5    }
    19.6  
    19.7 -  Status = WdfDeviceCreateDeviceInterface(Device, (LPGUID)&GUID_XEN_IFACE_XEN, NULL);
    19.8 +  Status = WdfDeviceCreateDeviceInterface(Device, (LPGUID)&GUID_XEN_IFACE, NULL);
    19.9    if (!NT_SUCCESS(Status))
   19.10    {
   19.11      KdPrint((__DRIVER_NAME "     WdfDeviceCreateDeviceInterface failed 0x%08x\n", Status));
   19.12 @@ -795,66 +795,35 @@ XenPCI_ChildListCreateDevice(
   19.13    memcpy(&ChildDeviceData->InterruptRaw, &InterruptRaw, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
   19.14    memcpy(&ChildDeviceData->InterruptTranslated, &InterruptTranslated, sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR));
   19.15    
   19.16 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->EvtChnInterface);
   19.17 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Version = 1;
   19.18 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
   19.19 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   19.20 -  ChildDeviceData->EvtChnInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   19.21 -  ChildDeviceData->EvtChnInterface.Bind = EvtChn_Bind;
   19.22 -  ChildDeviceData->EvtChnInterface.Unbind = EvtChn_Unbind;
   19.23 -  ChildDeviceData->EvtChnInterface.Mask = EvtChn_Mask;
   19.24 -  ChildDeviceData->EvtChnInterface.Unmask = EvtChn_Unmask;
   19.25 -  ChildDeviceData->EvtChnInterface.Notify = EvtChn_Notify;
   19.26 -  ChildDeviceData->EvtChnInterface.AllocUnbound = EvtChn_AllocUnbound;
   19.27 -  ChildDeviceData->EvtChnInterface.BindDpc = EvtChn_BindDpc;
   19.28 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->EvtChnInterface, &GUID_XEN_IFACE_EVTCHN, NULL);
   19.29 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
   19.30 -  if (!NT_SUCCESS(status))
   19.31 -  {
   19.32 -    return status;
   19.33 -  }
   19.34 -
   19.35 -/*
   19.36    ChildDeviceData->XenInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->XenInterface);
   19.37    ChildDeviceData->XenInterface.InterfaceHeader.Version = 1;
   19.38 -  ChildDeviceData->XenInterface.InterfaceHeader.Context = NULL;
   19.39 +  ChildDeviceData->XenInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
   19.40    ChildDeviceData->XenInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   19.41    ChildDeviceData->XenInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   19.42 -  ChildDeviceData->XenInterface.AllocMMIO = XenPCI_AllocMMIO;
   19.43 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE_XEN, NULL);
   19.44 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
   19.45 -  if (!NT_SUCCESS(status)) {
   19.46 -    return status;
   19.47 -  }
   19.48 -*/
   19.49  
   19.50 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->GntTblInterface);
   19.51 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Version = 1;
   19.52 -  ChildDeviceData->GntTblInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
   19.53 -  ChildDeviceData->GntTblInterface.InterfaceHeader.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   19.54 -  ChildDeviceData->GntTblInterface.InterfaceHeader.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   19.55 -  ChildDeviceData->GntTblInterface.GrantAccess = GntTbl_GrantAccess;
   19.56 -  ChildDeviceData->GntTblInterface.EndAccess = GntTbl_EndAccess;
   19.57 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->GntTblInterface, &GUID_XEN_IFACE_GNTTBL, NULL);
   19.58 -  status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
   19.59 -  if (!NT_SUCCESS(status)) {
   19.60 -    return status;
   19.61 -  }
   19.62 +  ChildDeviceData->XenInterface.AllocMMIO = XenPCI_AllocMMIO;
   19.63  
   19.64 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Size = sizeof(ChildDeviceData->XenBusInterface);
   19.65 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Version = 1;
   19.66 -  ChildDeviceData->XenBusInterface.InterfaceHeader.Context = WdfPdoGetParent(ChildDevice);
   19.67 -  //XenBusInterface.InterfaceHeader.Context = ExAllocatePoolWithTag(NonPagedPool, (strlen(XenIdentificationDesc->Path) + 1), XENPCI_POOL_TAG);
   19.68 -  //strcpy(XenBusInterface.InterfaceHeader.Context, XenIdentificationDesc->Path);
   19.69 -  ChildDeviceData->XenBusInterface.Read = XenBus_Read;
   19.70 -  ChildDeviceData->XenBusInterface.Write = XenBus_Write;
   19.71 -  ChildDeviceData->XenBusInterface.Printf = XenBus_Printf;
   19.72 -  ChildDeviceData->XenBusInterface.StartTransaction = XenBus_StartTransaction;
   19.73 -  ChildDeviceData->XenBusInterface.EndTransaction = XenBus_EndTransaction;
   19.74 -  ChildDeviceData->XenBusInterface.List = XenBus_List;
   19.75 -  ChildDeviceData->XenBusInterface.AddWatch = XenBus_AddWatch;
   19.76 -  ChildDeviceData->XenBusInterface.RemWatch = XenBus_RemWatch;
   19.77 -  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenBusInterface, &GUID_XEN_IFACE_XENBUS, NULL);
   19.78 +  ChildDeviceData->XenInterface.EvtChn_Bind = EvtChn_Bind;
   19.79 +  ChildDeviceData->XenInterface.EvtChn_Unbind = EvtChn_Unbind;
   19.80 +  ChildDeviceData->XenInterface.EvtChn_Mask = EvtChn_Mask;
   19.81 +  ChildDeviceData->XenInterface.EvtChn_Unmask = EvtChn_Unmask;
   19.82 +  ChildDeviceData->XenInterface.EvtChn_Notify = EvtChn_Notify;
   19.83 +  ChildDeviceData->XenInterface.EvtChn_AllocUnbound = EvtChn_AllocUnbound;
   19.84 +  ChildDeviceData->XenInterface.EvtChn_BindDpc = EvtChn_BindDpc;
   19.85 +
   19.86 +  ChildDeviceData->XenInterface.GntTbl_GrantAccess = GntTbl_GrantAccess;
   19.87 +  ChildDeviceData->XenInterface.GntTbl_EndAccess = GntTbl_EndAccess;
   19.88 +
   19.89 +  ChildDeviceData->XenInterface.XenBus_Read = XenBus_Read;
   19.90 +  ChildDeviceData->XenInterface.XenBus_Write = XenBus_Write;
   19.91 +  ChildDeviceData->XenInterface.XenBus_Printf = XenBus_Printf;
   19.92 +  ChildDeviceData->XenInterface.XenBus_StartTransaction = XenBus_StartTransaction;
   19.93 +  ChildDeviceData->XenInterface.XenBus_EndTransaction = XenBus_EndTransaction;
   19.94 +  ChildDeviceData->XenInterface.XenBus_List = XenBus_List;
   19.95 +  ChildDeviceData->XenInterface.XenBus_AddWatch = XenBus_AddWatch;
   19.96 +  ChildDeviceData->XenInterface.XenBus_RemWatch = XenBus_RemWatch;
   19.97 +
   19.98 +  WDF_QUERY_INTERFACE_CONFIG_INIT(&qiConfig, (PINTERFACE)&ChildDeviceData->XenInterface, &GUID_XEN_IFACE, NULL);
   19.99    status = WdfDeviceAddQueryInterface(ChildDevice, &qiConfig);
  19.100    if (!NT_SUCCESS(status)) {
  19.101      return status;
    20.1 --- a/xenpci/xenpci.h	Thu Dec 20 21:37:20 2007 +1100
    20.2 +++ b/xenpci/xenpci.h	Thu Dec 27 20:49:42 2007 +1100
    20.3 @@ -42,10 +42,7 @@ Foundation, Inc., 51 Franklin Street, Fi
    20.4  #include <hvm/params.h>
    20.5  #include <hvm/hvm_op.h>
    20.6  
    20.7 -#include <evtchn_public.h>
    20.8 -#include <xenbus_public.h>
    20.9  #include <xen_public.h>
   20.10 -#include <gnttbl_public.h>
   20.11  
   20.12  //{C828ABE9-14CA-4445-BAA6-82C2376C6518}
   20.13  DEFINE_GUID( GUID_XENPCI_DEVCLASS, 0xC828ABE9, 0x14CA, 0x4445, 0xBA, 0xA6, 0x82, 0xC2, 0x37, 0x6C, 0x65, 0x18);
   20.14 @@ -59,13 +56,6 @@ DEFINE_GUID( GUID_XENPCI_DEVCLASS, 0xC82
   20.15  
   20.16  #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
   20.17  
   20.18 -typedef struct _XENPCI_IDENTIFICATION_DESCRIPTION
   20.19 -{
   20.20 -  WDF_CHILD_IDENTIFICATION_DESCRIPTION_HEADER Header;
   20.21 -  UNICODE_STRING DeviceType;
   20.22 -  char Path[128];
   20.23 -} XENPCI_IDENTIFICATION_DESCRIPTION, *PXENPCI_IDENTIFICATION_DESCRIPTION;
   20.24 -
   20.25  typedef struct _ev_action_t {
   20.26    PKSERVICE_ROUTINE ServiceRoutine;
   20.27    PVOID ServiceContext;
    21.1 --- a/xenvbd/sources	Thu Dec 20 21:37:20 2007 +1100
    21.2 +++ b/xenvbd/sources	Thu Dec 27 20:49:42 2007 +1100
    21.3 @@ -1,7 +1,7 @@
    21.4  TARGETNAME=XENVBD
    21.5  TARGETTYPE=DRIVER
    21.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
    21.7 -VERSION=0.5.0.0
    21.8 +VERSION=0.5.0.3
    21.9  KMDF_VERSION=1
   21.10  MSC_WARNING_LEVEL=/W4
   21.11  INF_NAME=xenvbd
    22.1 --- a/xenvbd/xenvbd.c	Thu Dec 20 21:37:20 2007 +1100
    22.2 +++ b/xenvbd/xenvbd.c	Thu Dec 27 20:49:42 2007 +1100
    22.3 @@ -219,9 +219,9 @@ XenVbd_HwScsiInterruptTarget(PVOID Devic
    22.4          Srb->SrbStatus = SRB_STATUS_ERROR;
    22.5        }
    22.6        for (j = 0; j < TargetData->shadow[rep->id].req.nr_segments; j++)
    22.7 -        DeviceData->XenDeviceData->GntTblInterface.EndAccess(
    22.8 -        DeviceData->XenDeviceData->GntTblInterface.InterfaceHeader.Context,
    22.9 -        TargetData->shadow[rep->id].req.seg[j].gref);
   22.10 +        DeviceData->XenDeviceData->XenInterface.GntTbl_EndAccess(
   22.11 +          DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.12 +          TargetData->shadow[rep->id].req.seg[j].gref);
   22.13        if (Srb->Cdb[0] == SCSIOP_READ)
   22.14          memcpy(Srb->DataBuffer, TargetData->shadow[rep->id].Buf, BlockCount * TargetData->BytesPerSector);
   22.15  
   22.16 @@ -298,8 +298,8 @@ XenVbd_BackEndStateHandler(char *Path, P
   22.17    TargetData = (PXENVBD_TARGET_DATA)Data;
   22.18    DeviceData = (PXENVBD_DEVICE_DATA)TargetData->DeviceData;
   22.19  
   22.20 -  DeviceData->XenDeviceData->XenBusInterface.Read(
   22.21 -    DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
   22.22 +  DeviceData->XenDeviceData->XenInterface.XenBus_Read(
   22.23 +    DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.24      XBT_NIL, Path, &Value);
   22.25  
   22.26    NewState = atoi(Value);
   22.27 @@ -316,18 +316,18 @@ XenVbd_BackEndStateHandler(char *Path, P
   22.28    case XenbusStateInitWait:
   22.29      KdPrint((__DRIVER_NAME "     Backend State Changed to InitWait\n"));  
   22.30  
   22.31 -    TargetData->EventChannel = DeviceData->XenDeviceData->EvtChnInterface.AllocUnbound(
   22.32 -      DeviceData->XenDeviceData->EvtChnInterface.InterfaceHeader.Context, 0);
   22.33 -    DeviceData->XenDeviceData->EvtChnInterface.Bind(
   22.34 -      DeviceData->XenDeviceData->EvtChnInterface.InterfaceHeader.Context,
   22.35 +    TargetData->EventChannel = DeviceData->XenDeviceData->XenInterface.EvtChn_AllocUnbound(
   22.36 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context, 0);
   22.37 +    DeviceData->XenDeviceData->XenInterface.EvtChn_Bind(
   22.38 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.39        TargetData->EventChannel, XenVbd_Interrupt, TargetData);
   22.40      Mdl = AllocatePage();
   22.41      PFN = *MmGetMdlPfnArray(Mdl);
   22.42      SharedRing = (blkif_sring_t *)MmGetMdlVirtualAddress(Mdl);
   22.43      SHARED_RING_INIT(SharedRing);
   22.44      FRONT_RING_INIT(&TargetData->Ring, SharedRing, PAGE_SIZE);
   22.45 -    ref = DeviceData->XenDeviceData->GntTblInterface.GrantAccess(
   22.46 -      DeviceData->XenDeviceData->GntTblInterface.InterfaceHeader.Context,
   22.47 +    ref = DeviceData->XenDeviceData->XenInterface.GntTbl_GrantAccess(
   22.48 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.49        0, PFN, FALSE);
   22.50  
   22.51      TargetData->shadow = ExAllocatePoolWithTag(NonPagedPool, sizeof(blkif_shadow_t) * BLK_RING_SIZE, XENVBD_POOL_TAG);
   22.52 @@ -344,15 +344,15 @@ XenVbd_BackEndStateHandler(char *Path, P
   22.53  
   22.54      RtlStringCbCopyA(TmpPath, 128, TargetData->Path);
   22.55      RtlStringCbCatA(TmpPath, 128, "/ring-ref");
   22.56 -    DeviceData->XenDeviceData->XenBusInterface.Printf(DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", ref);
   22.57 +    DeviceData->XenDeviceData->XenInterface.XenBus_Printf(DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", ref);
   22.58  
   22.59      RtlStringCbCopyA(TmpPath, 128, TargetData->Path);
   22.60      RtlStringCbCatA(TmpPath, 128, "/event-channel");
   22.61 -    DeviceData->XenDeviceData->XenBusInterface.Printf(DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", TargetData->EventChannel);
   22.62 +    DeviceData->XenDeviceData->XenInterface.XenBus_Printf(DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", TargetData->EventChannel);
   22.63    
   22.64      RtlStringCbCopyA(TmpPath, 128, TargetData->Path);
   22.65      RtlStringCbCatA(TmpPath, 128, "/state");
   22.66 -    DeviceData->XenDeviceData->XenBusInterface.Printf(DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", XenbusStateInitialised);
   22.67 +    DeviceData->XenDeviceData->XenInterface.XenBus_Printf(DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", XenbusStateInitialised);
   22.68  
   22.69      KdPrint((__DRIVER_NAME "     Set Frontend state to Initialised\n"));
   22.70      break;
   22.71 @@ -366,8 +366,8 @@ XenVbd_BackEndStateHandler(char *Path, P
   22.72  
   22.73      RtlStringCbCopyA(TmpPath, 128, TargetData->Path);
   22.74      RtlStringCbCatA(TmpPath, 128, "/device-type");
   22.75 -    DeviceData->XenDeviceData->XenBusInterface.Read(
   22.76 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
   22.77 +    DeviceData->XenDeviceData->XenInterface.XenBus_Read(
   22.78 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.79        XBT_NIL, TmpPath, &Value);
   22.80      if (strcmp(Value, "disk") == 0)
   22.81      {
   22.82 @@ -387,24 +387,24 @@ XenVbd_BackEndStateHandler(char *Path, P
   22.83  
   22.84      RtlStringCbCopyA(TmpPath, 128, TargetData->BackendPath);
   22.85      RtlStringCbCatA(TmpPath, 128, "/type"); // should probably check that this is 'phy' or 'file' or at least not ''
   22.86 -    DeviceData->XenDeviceData->XenBusInterface.Read(
   22.87 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
   22.88 +    DeviceData->XenDeviceData->XenInterface.XenBus_Read(
   22.89 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
   22.90        XBT_NIL, TmpPath, &Value);
   22.91      KdPrint((__DRIVER_NAME "     Backend Type = %s\n", Value));
   22.92      ExFreePool(Value);
   22.93  
   22.94      RtlStringCbCopyA(TmpPath, 128, TargetData->BackendPath);
   22.95      RtlStringCbCatA(TmpPath, 128, "/mode"); // should store this...
   22.96 -    DeviceData->XenDeviceData->XenBusInterface.Read(
   22.97 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
   22.98 +    DeviceData->XenDeviceData->XenInterface.XenBus_Read(
   22.99 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.100        XBT_NIL, TmpPath, &Value);
  22.101      KdPrint((__DRIVER_NAME "     Backend Mode = %s\n", Value));
  22.102      ExFreePool(Value);
  22.103  
  22.104      RtlStringCbCopyA(TmpPath, 128, TargetData->BackendPath);
  22.105      RtlStringCbCatA(TmpPath, 128, "/sector-size");
  22.106 -    DeviceData->XenDeviceData->XenBusInterface.Read(
  22.107 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
  22.108 +    DeviceData->XenDeviceData->XenInterface.XenBus_Read(
  22.109 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.110        XBT_NIL, TmpPath, &Value);
  22.111      // should complain if Value == NULL
  22.112      TargetData->BytesPerSector = atoi(Value);
  22.113 @@ -413,8 +413,8 @@ XenVbd_BackEndStateHandler(char *Path, P
  22.114  
  22.115      RtlStringCbCopyA(TmpPath, 128, TargetData->BackendPath);
  22.116      RtlStringCbCatA(TmpPath, 128, "/sectors");
  22.117 -    DeviceData->XenDeviceData->XenBusInterface.Read(
  22.118 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
  22.119 +    DeviceData->XenDeviceData->XenInterface.XenBus_Read(
  22.120 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.121        XBT_NIL, TmpPath, &Value);
  22.122      // should complain if Value == NULL
  22.123      TargetData->TotalSectors = (ULONGLONG)atol(Value);
  22.124 @@ -434,7 +434,7 @@ XenVbd_BackEndStateHandler(char *Path, P
  22.125  
  22.126      RtlStringCbCopyA(TmpPath, 128, TargetData->Path);
  22.127      RtlStringCbCatA(TmpPath, 128, "/state");
  22.128 -    DeviceData->XenDeviceData->XenBusInterface.Printf(DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", XenbusStateConnected);
  22.129 +    DeviceData->XenDeviceData->XenInterface.XenBus_Printf(DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context, XBT_NIL, TmpPath, "%d", XenbusStateConnected);
  22.130  
  22.131      KdPrint((__DRIVER_NAME "     Set Frontend state to Connected\n"));
  22.132      InterlockedIncrement(&DeviceData->EnumeratedDevices);
  22.133 @@ -518,8 +518,8 @@ XenVbd_WatchHandler(char *Path, PVOID De
  22.134  
  22.135        RtlStringCbCopyA(TmpPath, 128, VacantTarget->Path);
  22.136        RtlStringCbCatA(TmpPath, 128, "/backend");
  22.137 -      DeviceData->XenDeviceData->XenBusInterface.Read(
  22.138 -        DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
  22.139 +      DeviceData->XenDeviceData->XenInterface.XenBus_Read(
  22.140 +        DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.141          XBT_NIL, TmpPath, &Value);
  22.142        if (Value == NULL)
  22.143          KdPrint((__DRIVER_NAME "     Read Failed\n"));
  22.144 @@ -528,8 +528,8 @@ XenVbd_WatchHandler(char *Path, PVOID De
  22.145        RtlStringCbCopyA(TmpPath, 128, VacantTarget->BackendPath);
  22.146        RtlStringCbCatA(TmpPath, 128, "/state");
  22.147  
  22.148 -      DeviceData->XenDeviceData->XenBusInterface.AddWatch(
  22.149 -        DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
  22.150 +      DeviceData->XenDeviceData->XenInterface.XenBus_AddWatch(
  22.151 +        DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.152          XBT_NIL, TmpPath, XenVbd_BackEndStateHandler, VacantTarget);
  22.153      }
  22.154      else
  22.155 @@ -588,8 +588,8 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
  22.156    DeviceData->EnumeratedDevices = 0;
  22.157    if (DeviceData->XenDeviceData->AutoEnumerate)
  22.158    {
  22.159 -    msg = DeviceData->XenDeviceData->XenBusInterface.List(
  22.160 -      DeviceData->XenDeviceData->XenBusInterface.InterfaceHeader.Context,
  22.161 +    msg = DeviceData->XenDeviceData->XenInterface.XenBus_List(
  22.162 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.163        XBT_NIL, "device/vbd", &VbdDevices);
  22.164      if (!msg) {
  22.165        for (i = 0; VbdDevices[i]; i++)
  22.166 @@ -722,8 +722,8 @@ XenVbd_PutSrbOnRing(PXENVBD_TARGET_DATA 
  22.167  
  22.168    for (i = 0; i < req->nr_segments; i++)
  22.169    {
  22.170 -    req->seg[i].gref = DeviceData->XenDeviceData->GntTblInterface.GrantAccess(
  22.171 -      DeviceData->XenDeviceData->GntTblInterface.InterfaceHeader.Context,
  22.172 +    req->seg[i].gref = DeviceData->XenDeviceData->XenInterface.GntTbl_GrantAccess(
  22.173 +      DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.174        0, MmGetMdlPfnArray(TargetData->shadow[req->id].Mdl)[i], FALSE);
  22.175      req->seg[i].first_sect = 0;
  22.176      if (i == req->nr_segments - 1)
  22.177 @@ -949,8 +949,8 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
  22.178        XenVbd_PutSrbOnRing(TargetData, Srb);
  22.179        RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&TargetData->Ring, notify);
  22.180        if (notify)
  22.181 -        DeviceData->XenDeviceData->EvtChnInterface.Notify(
  22.182 -          DeviceData->XenDeviceData->EvtChnInterface.InterfaceHeader.Context,
  22.183 +        DeviceData->XenDeviceData->XenInterface.EvtChn_Notify(
  22.184 +          DeviceData->XenDeviceData->XenInterface.InterfaceHeader.Context,
  22.185            TargetData->EventChannel);
  22.186        if (!RING_FULL(&TargetData->Ring))
  22.187          ScsiPortNotification(NextLuRequest, DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
    23.1 --- a/xenvbd/xenvbd.h	Thu Dec 20 21:37:20 2007 +1100
    23.2 +++ b/xenvbd/xenvbd.h	Thu Dec 27 20:49:42 2007 +1100
    23.3 @@ -21,9 +21,6 @@
    23.4  #include <hvm/params.h>
    23.5  #include <hvm/hvm_op.h>
    23.6  #include <xen_public.h>
    23.7 -#include <evtchn_public.h>
    23.8 -#include <xenbus_public.h>
    23.9 -#include <gnttbl_public.h>
   23.10  #include <io/ring.h>
   23.11  #include <io/blkif.h>
   23.12