win-pvdrivers

changeset 1020:2cbbfed14af4

Tidyup.
author James Harper <james.harper@bendigoit.com.au>
date Tue Feb 12 20:48:34 2013 +1100 (2013-02-12)
parents df03fde445b8
children 6547b07f3236
files common/include/xen_windows.h
line diff
     1.1 --- a/common/include/xen_windows.h	Tue Feb 12 20:45:25 2013 +1100
     1.2 +++ b/common/include/xen_windows.h	Tue Feb 12 20:48:34 2013 +1100
     1.3 @@ -56,48 +56,34 @@ typedef unsigned long xenbus_transaction
     1.4  #define wmb() KeMemoryBarrier()
     1.5  #define mb() KeMemoryBarrier()
     1.6  
     1.7 -//#define IOCTL_XEN_RECONFIGURE CTL_CODE(0x8000, 0x800, METHOD_NEITHER, 0)
     1.8 -//#define IOCTL_XEN_SUSPEND CTL_CODE(0x8000, 0x801, METHOD_NEITHER, 0)
     1.9 -//#define IOCTL_XEN_RESUME  CTL_CODE(0x8000, 0x802, METHOD_NEITHER, 0)
    1.10 -
    1.11  static __inline char **
    1.12 -SplitString(char *String, char Split, int MaxParts, int *Count)
    1.13 -{
    1.14 +SplitString(char *String, char Split, int MaxParts, int *Count) {
    1.15    char **RetVal;
    1.16    char *first;
    1.17    char *last;
    1.18  
    1.19 -  //KdPrint((__DRIVER_NAME "     a\n"));
    1.20 -
    1.21    *Count = 0;
    1.22  
    1.23    RetVal = (char **)ExAllocatePoolWithTag(NonPagedPool, (MaxParts + 1) * sizeof(char *), SPLITSTRING_POOL_TAG);
    1.24    last = String;
    1.25 -  do
    1.26 -  {
    1.27 +  do {
    1.28      if (*Count == MaxParts)
    1.29        break;
    1.30 -    //KdPrint((__DRIVER_NAME "     b - count = %d\n", *Count));
    1.31      first = last;
    1.32      for (last = first; *last != '\0' && *last != Split; last++);
    1.33      RetVal[*Count] = (char *)ExAllocatePoolWithTag(NonPagedPool, last - first + 1, SPLITSTRING_POOL_TAG);
    1.34 -    //KdPrint((__DRIVER_NAME "     c - count = %d\n", *Count));
    1.35      RtlStringCbCopyNA(RetVal[*Count], last - first + 1, first, last - first);
    1.36      RetVal[*Count][last - first] = 0;
    1.37 -    //KdPrint((__DRIVER_NAME "     d - count = %d\n", *Count));
    1.38      (*Count)++;
    1.39 -    //KdPrint((__DRIVER_NAME "     e - count = %d\n", *Count));
    1.40      if (*last == Split)
    1.41        last++;
    1.42    } while (*last != 0);
    1.43 -  //KdPrint((__DRIVER_NAME "     f - count = %d\n", *Count));
    1.44    RetVal[*Count] = NULL;
    1.45    return RetVal;
    1.46  }
    1.47  
    1.48  static __inline VOID
    1.49 -FreeSplitString(char **Bits, int Count)
    1.50 -{
    1.51 +FreeSplitString(char **Bits, int Count) {
    1.52    int i;
    1.53  
    1.54    for (i = 0; i < Count; i++)
    1.55 @@ -114,16 +100,13 @@ AllocatePagesExtra(int Pages, int ExtraS
    1.56    PVOID Buf;
    1.57  
    1.58    Buf = ExAllocatePoolWithTag(NonPagedPool, Pages * PAGE_SIZE, ALLOCATE_PAGES_POOL_TAG);
    1.59 -  if (Buf == NULL)
    1.60 -  {
    1.61 +  if (Buf == NULL) {
    1.62      KdPrint((__DRIVER_NAME "     AllocatePages Failed at ExAllocatePoolWithTag\n"));
    1.63      return NULL;
    1.64    }
    1.65 -//  KdPrint((__DRIVER_NAME " --- AllocatePages IRQL = %d, Buf = %p\n", KeGetCurrentIrql(), Buf));
    1.66    Mdl = (PMDL)ExAllocatePoolWithTag(NonPagedPool, MmSizeOfMdl(Buf, Pages * PAGE_SIZE) + ExtraSize, ALLOCATE_PAGES_POOL_TAG);
    1.67 -  if (Mdl == NULL)
    1.68 -  {
    1.69 -    // free the memory here
    1.70 +  if (Mdl == NULL) {
    1.71 +    ExFreePoolWithTag(Buf, ALLOCATE_PAGES_POOL_TAG);
    1.72      KdPrint((__DRIVER_NAME "     AllocatePages Failed at IoAllocateMdl\n"));
    1.73      return NULL;
    1.74    }
    1.75 @@ -135,20 +118,17 @@ AllocatePagesExtra(int Pages, int ExtraS
    1.76  }
    1.77  
    1.78  static __inline PMDL
    1.79 -AllocatePages(int Pages)
    1.80 -{
    1.81 +AllocatePages(int Pages) {
    1.82    return AllocatePagesExtra(Pages, 0);
    1.83  }
    1.84  
    1.85  static __inline PMDL
    1.86 -AllocatePage()
    1.87 -{
    1.88 +AllocatePage() {
    1.89    return AllocatePagesExtra(1, 0);
    1.90  }
    1.91  
    1.92  static __inline PMDL
    1.93 -AllocateUncachedPage()
    1.94 -{
    1.95 +AllocateUncachedPage() {
    1.96    PMDL mdl;
    1.97    PVOID buf;
    1.98  
    1.99 @@ -160,8 +140,7 @@ AllocateUncachedPage()
   1.100  }  
   1.101  
   1.102  static __inline VOID
   1.103 -FreeUncachedPage(PMDL mdl)
   1.104 -{
   1.105 +FreeUncachedPage(PMDL mdl) {
   1.106    PVOID buf = MmGetMdlVirtualAddress(mdl);
   1.107  
   1.108    IoFreeMdl(mdl);
   1.109 @@ -169,11 +148,8 @@ FreeUncachedPage(PMDL mdl)
   1.110  }
   1.111  
   1.112  static __inline VOID
   1.113 -FreePages(PMDL Mdl)
   1.114 -{
   1.115 +FreePages(PMDL Mdl) {
   1.116    PVOID Buf = MmGetMdlVirtualAddress(Mdl);
   1.117 -//  KdPrint((__DRIVER_NAME " --- FreePages IRQL = %d, Buf = %p\n", KeGetCurrentIrql(), Buf));
   1.118 -//  IoFreeMdl(Mdl);
   1.119    ExFreePoolWithTag(Mdl, ALLOCATE_PAGES_POOL_TAG);
   1.120    ExFreePoolWithTag(Buf, ALLOCATE_PAGES_POOL_TAG);
   1.121  }
   1.122 @@ -211,7 +187,6 @@ the wrong width is used with the wrong d
   1.123  #define XN_DEVICE_CALLBACK_SUSPEND       2
   1.124  #define XN_DEVICE_CALLBACK_RESUME        3
   1.125  
   1.126 -
   1.127  typedef PVOID XN_HANDLE;
   1.128  
   1.129  typedef VOID
   1.130 @@ -234,22 +209,10 @@ XnCloseDevice(XN_HANDLE handle);
   1.131  
   1.132  #define XN_VALUE_TYPE_QEMU_HIDE_FLAGS 1
   1.133  #define XN_VALUE_TYPE_QEMU_FILTER     2 /* true if qemu devices hidden by device filter, not by qemu */
   1.134 +
   1.135  VOID
   1.136  XnGetValue(XN_HANDLE handle, ULONG value_type, PVOID value);
   1.137  
   1.138 -#if 0
   1.139 -PCHAR
   1.140 -XnGetBackendPath(XN_HANDLE handle);
   1.141 -#endif
   1.142 -
   1.143 -#if 0
   1.144 -NTSTATUS
   1.145 -XnAddWatch(XN_HANDLE handle, ULONG base, char *path, PXN_WATCH_CALLBACK callback, PVOID context);
   1.146 -
   1.147 -NTSTATUS
   1.148 -XnRemoveWatch(XN_HANDLE handle, ULONG base, char *path, PXN_WATCH_CALLBACK callback, PVOID context);
   1.149 -#endif
   1.150 -
   1.151  NTSTATUS
   1.152  XnReadInt32(XN_HANDLE handle, ULONG base, PCHAR path, ULONG *value);
   1.153  
   1.154 @@ -306,479 +269,4 @@ XnFreeMem(XN_HANDLE handle, PVOID Ptr) {
   1.155  VOID
   1.156  XnDumpModeHookDebugPrint();
   1.157  
   1.158 -
   1.159 -
   1.160 -
   1.161 -
   1.162 -#if 0
   1.163 -typedef PHYSICAL_ADDRESS
   1.164 -(*PXEN_ALLOCMMIO)(PVOID Context, ULONG Length);
   1.165 -
   1.166 -typedef void
   1.167 -(*PXEN_FREEMEM)(PVOID Ptr);
   1.168 -#endif
   1.169 -
   1.170 -#if 0
   1.171 -
   1.172 -typedef VOID
   1.173 -(*PXEN_EVTCHN_SERVICE_ROUTINE)(PVOID Context);
   1.174 -
   1.175 -typedef NTSTATUS
   1.176 -(*PXEN_EVTCHN_BIND)(PVOID Context, evtchn_port_t Port, PXEN_EVTCHN_SERVICE_ROUTINE ServiceRoutine, PVOID ServiceContext);
   1.177 -
   1.178 -typedef NTSTATUS
   1.179 -(*PXEN_EVTCHN_UNBIND)(PVOID Context, evtchn_port_t Port);
   1.180 -
   1.181 -typedef NTSTATUS
   1.182 -(*PXEN_EVTCHN_MASK)(PVOID Context, evtchn_port_t Port);
   1.183 -
   1.184 -typedef NTSTATUS
   1.185 -(*PXEN_EVTCHN_UNMASK)(PVOID Context, evtchn_port_t Port);
   1.186 -
   1.187 -typedef NTSTATUS
   1.188 -(*PXEN_EVTCHN_NOTIFY)(PVOID Context, evtchn_port_t Port);
   1.189 -
   1.190 -typedef evtchn_port_t
   1.191 -(*PXEN_EVTCHN_ALLOCUNBOUND)(PVOID Context, domid_t Domain);
   1.192 -
   1.193 -typedef BOOLEAN
   1.194 -(*PXEN_EVTCHN_ACK_EVENT)(PVOID context, evtchn_port_t port, BOOLEAN *last_interrupt);
   1.195 -
   1.196 -typedef BOOLEAN
   1.197 -(*PXEN_EVTCHN_SYNC_ROUTINE)(PVOID sync_context);
   1.198 -
   1.199 -typedef BOOLEAN
   1.200 -(*PXEN_EVTCHN_SYNC)(PVOID Context, PXEN_EVTCHN_SYNC_ROUTINE sync_routine, PVOID sync_context);
   1.201 -
   1.202 -typedef grant_ref_t
   1.203 -(*PXEN_GNTTBL_GRANTACCESS)(PVOID Context, uint32_t frame, int readonly, grant_ref_t ref, ULONG tag);
   1.204 -
   1.205 -typedef BOOLEAN
   1.206 -(*PXEN_GNTTBL_ENDACCESS)(PVOID Context, grant_ref_t ref, BOOLEAN keepref, ULONG tag);
   1.207 -
   1.208 -typedef VOID
   1.209 -(*PXEN_GNTTBL_PUTREF)(PVOID Context, grant_ref_t ref, ULONG tag);
   1.210 -
   1.211 -typedef grant_ref_t
   1.212 -(*PXEN_GNTTBL_GETREF)(PVOID Context, ULONG tag);
   1.213 -
   1.214 -
   1.215 -typedef VOID
   1.216 -(*PXENBUS_WATCH_CALLBACK)(char *Path, PVOID ServiceContext);
   1.217 -
   1.218 -typedef char *
   1.219 -(*PXEN_XENBUS_READ)(PVOID Context, xenbus_transaction_t xbt, char *path, char **value);
   1.220 -
   1.221 -typedef char *
   1.222 -(*PXEN_XENBUS_WRITE)(PVOID Context, xenbus_transaction_t xbt, char *path, char *value);
   1.223 -
   1.224 -typedef char *
   1.225 -(*PXEN_XENBUS_PRINTF)(PVOID Context, xenbus_transaction_t xbt, char *path, char *fmt, ...);
   1.226 -
   1.227 -typedef char *
   1.228 -(*PXEN_XENBUS_STARTTRANSACTION)(PVOID Context, xenbus_transaction_t *xbt);
   1.229 -
   1.230 -typedef char *
   1.231 -(*PXEN_XENBUS_ENDTRANSACTION)(PVOID Context, xenbus_transaction_t t, int abort, int *retry);
   1.232 -
   1.233 -typedef char *
   1.234 -(*PXEN_XENBUS_LIST)(PVOID Context, xenbus_transaction_t xbt, char *prefix, char ***contents);
   1.235 -
   1.236 -typedef char *
   1.237 -(*PXEN_XENBUS_ADDWATCH)(PVOID Context, xenbus_transaction_t xbt, char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
   1.238 -
   1.239 -typedef char *
   1.240 -(*PXEN_XENBUS_REMWATCH)(PVOID Context, xenbus_transaction_t xbt, char *Path, PXENBUS_WATCH_CALLBACK ServiceRoutine, PVOID ServiceContext);
   1.241 -
   1.242 -typedef NTSTATUS
   1.243 -(*PXEN_XENPCI_XEN_CONFIG_DEVICE)(PVOID Context);
   1.244 -
   1.245 -typedef NTSTATUS
   1.246 -(*PXEN_XENPCI_XEN_SHUTDOWN_DEVICE)(PVOID Context);
   1.247 -
   1.248 -#define XEN_DATA_MAGIC (ULONG)'XV02'
   1.249 -
   1.250 -typedef struct {
   1.251 -  ULONG magic;
   1.252 -  USHORT length;
   1.253 -
   1.254 -  PVOID context;
   1.255 -  PXEN_EVTCHN_BIND EvtChn_Bind;
   1.256 -  PXEN_EVTCHN_BIND EvtChn_BindDpc;
   1.257 -  PXEN_EVTCHN_UNBIND EvtChn_Unbind;
   1.258 -  PXEN_EVTCHN_MASK EvtChn_Mask;
   1.259 -  PXEN_EVTCHN_UNMASK EvtChn_Unmask;
   1.260 -  PXEN_EVTCHN_NOTIFY EvtChn_Notify;
   1.261 -  PXEN_EVTCHN_ACK_EVENT EvtChn_AckEvent;
   1.262 -  PXEN_EVTCHN_SYNC EvtChn_Sync;
   1.263 -
   1.264 -  PXEN_GNTTBL_GETREF GntTbl_GetRef;
   1.265 -  PXEN_GNTTBL_PUTREF GntTbl_PutRef;
   1.266 -  PXEN_GNTTBL_GRANTACCESS GntTbl_GrantAccess;
   1.267 -  PXEN_GNTTBL_ENDACCESS GntTbl_EndAccess;
   1.268 -
   1.269 -  PXEN_XENPCI_XEN_CONFIG_DEVICE XenPci_XenConfigDevice;
   1.270 -  PXEN_XENPCI_XEN_SHUTDOWN_DEVICE XenPci_XenShutdownDevice;
   1.271 -
   1.272 -  CHAR path[128];
   1.273 -  CHAR backend_path[128];
   1.274 -
   1.275 -  PXEN_XENBUS_READ XenBus_Read;
   1.276 -  PXEN_XENBUS_WRITE XenBus_Write;
   1.277 -  PXEN_XENBUS_PRINTF XenBus_Printf;
   1.278 -  PXEN_XENBUS_STARTTRANSACTION XenBus_StartTransaction;
   1.279 -  PXEN_XENBUS_ENDTRANSACTION XenBus_EndTransaction;
   1.280 -  PXEN_XENBUS_LIST XenBus_List;
   1.281 -  PXEN_XENBUS_ADDWATCH XenBus_AddWatch;
   1.282 -  PXEN_XENBUS_REMWATCH XenBus_RemWatch;
   1.283 -
   1.284 -} XENPCI_VECTORS, *PXENPCI_VECTORS;
   1.285 -
   1.286 -/*
   1.287 -suspend_resume_state_xxx values
   1.288 -pdo will assert a value, and fdo will assert when complete
   1.289 -*/
   1.290 -#define SR_STATE_RUNNING            0 /* normal working state */
   1.291 -#define SR_STATE_SUSPENDING         1 /* suspend has started */
   1.292 -#define SR_STATE_RESUMING           2 /* resume has started */
   1.293 -
   1.294 -#define XEN_DEVICE_STATE_MAGIC ((ULONG)'XDST')
   1.295 -
   1.296 -typedef struct {
   1.297 -  ULONG magic;
   1.298 -  USHORT length;
   1.299 -
   1.300 -  ULONG suspend_resume_state_pdo; /* only the PDO can touch this */
   1.301 -  ULONG suspend_resume_state_fdo; /* only the FDO can touch this */
   1.302 -  evtchn_port_t pdo_event_channel;
   1.303 -} XENPCI_DEVICE_STATE, *PXENPCI_DEVICE_STATE;
   1.304 -
   1.305 -#define XEN_INIT_DRIVER_EXTENSION_MAGIC ((ULONG)'XCFG')
   1.306 -#define XEN_DMA_DRIVER_EXTENSION_MAGIC ((ULONG)'XDMA')
   1.307 -
   1.308 -#define XEN_INIT_TYPE_END                       0
   1.309 -#define XEN_INIT_TYPE_WRITE_STRING              1
   1.310 -#define XEN_INIT_TYPE_RING                      2
   1.311 -#define XEN_INIT_TYPE_EVENT_CHANNEL             3
   1.312 -#define XEN_INIT_TYPE_EVENT_CHANNEL_IRQ         4
   1.313 -#define XEN_INIT_TYPE_READ_STRING_FRONT         5
   1.314 -#define XEN_INIT_TYPE_READ_STRING_BACK          6
   1.315 -#define XEN_INIT_TYPE_VECTORS                   7
   1.316 -#define XEN_INIT_TYPE_GRANT_ENTRIES             8
   1.317 -#define XEN_INIT_TYPE_STATE_PTR                 11
   1.318 -#define XEN_INIT_TYPE_QEMU_PROTOCOL_VERSION     13
   1.319 -#define XEN_INIT_TYPE_EVENT_CHANNEL_DPC         16
   1.320 -#define XEN_INIT_TYPE_QEMU_HIDE_FLAGS           17 /* qemu hide flags */
   1.321 -#define XEN_INIT_TYPE_QEMU_HIDE_FILTER          18 /* qemu device hidden by class filter */
   1.322 -/*
   1.323 - state maps consist of 3 bytes: (maximum of 4 x 3 bytes)
   1.324 -  front - state to set frontend to
   1.325 -  back - state to expect from backend
   1.326 -  wait - time in 100ms intervals to wait for backend
   1.327 - a single 0 byte terminates the list
   1.328 -*/
   1.329 -#define XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT  19
   1.330 -#define XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT 20
   1.331 -#define XEN_INIT_TYPE_XB_STATE_MAP_SHUTDOWN     21
   1.332 -
   1.333 -static __inline VOID
   1.334 -__ADD_XEN_INIT_UCHAR(PUCHAR *ptr, UCHAR val)
   1.335 -{
   1.336 -//  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_UCHAR *ptr = %p, val = %d\n", *ptr, val));
   1.337 -  *(PUCHAR)(*ptr) = val;
   1.338 -  *ptr += sizeof(UCHAR);
   1.339 -}
   1.340 -
   1.341 -static __inline VOID
   1.342 -__ADD_XEN_INIT_USHORT(PUCHAR *ptr, USHORT val)
   1.343 -{
   1.344 -//  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_USHORT *ptr = %p, val = %d\n", *ptr, val));
   1.345 -  *(PUSHORT)(*ptr) = val;
   1.346 -  *ptr += sizeof(USHORT);
   1.347 -}
   1.348 -
   1.349 -static __inline VOID
   1.350 -__ADD_XEN_INIT_ULONG(PUCHAR *ptr, ULONG val)
   1.351 -{
   1.352 -//  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_ULONG *ptr = %p, val = %d\n", *ptr, val));
   1.353 -  *(PULONG)(*ptr) = val;
   1.354 -  *ptr += sizeof(ULONG);
   1.355 -}
   1.356 -
   1.357 -static __inline VOID
   1.358 -__ADD_XEN_INIT_PTR(PUCHAR *ptr, PVOID val)
   1.359 -{
   1.360 -//  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_PTR *ptr = %p, val = %p\n", *ptr, val));
   1.361 -  *(PVOID *)(*ptr) = val;
   1.362 -  *ptr += sizeof(PVOID);
   1.363 -}
   1.364 -
   1.365 -static __inline VOID
   1.366 -__ADD_XEN_INIT_STRING(PUCHAR *ptr, PCHAR val)
   1.367 -{
   1.368 -//  KdPrint((__DRIVER_NAME "     ADD_XEN_INIT_STRING *ptr = %p, val = %s\n", *ptr, val));
   1.369 -  size_t max_string_size = PAGE_SIZE - (PtrToUlong(*ptr) & (PAGE_SIZE - 1));
   1.370 -  RtlStringCbCopyA((PCHAR)*ptr, max_string_size, val);
   1.371 -  *ptr += min(strlen(val) + 1, max_string_size);
   1.372 -}
   1.373 -
   1.374 -static __inline UCHAR
   1.375 -__GET_XEN_INIT_UCHAR(PUCHAR *ptr)
   1.376 -{
   1.377 -  UCHAR retval;
   1.378 -  retval = **ptr;
   1.379 -//  KdPrint((__DRIVER_NAME "     GET_XEN_INIT_UCHAR *ptr = %p, retval = %d\n", *ptr, retval));
   1.380 -  *ptr += sizeof(UCHAR);
   1.381 -  return retval;
   1.382 -}
   1.383 -
   1.384 -static __inline USHORT
   1.385 -__GET_XEN_INIT_USHORT(PUCHAR *ptr)
   1.386 -{
   1.387 -  USHORT retval;
   1.388 -  retval = *(PUSHORT)*ptr;
   1.389 -//  KdPrint((__DRIVER_NAME "     GET_XEN_INIT_USHORT *ptr = %p, retval = %d\n", *ptr, retval));
   1.390 -  *ptr += sizeof(USHORT);
   1.391 -  return retval;
   1.392 -}
   1.393 -
   1.394 -static __inline ULONG
   1.395 -__GET_XEN_INIT_ULONG(PUCHAR *ptr)
   1.396 -{
   1.397 -  ULONG retval;
   1.398 -  retval = *(PLONG)*ptr;
   1.399 -//  KdPrint((__DRIVER_NAME "     GET_XEN_INIT_ULONG *ptr = %p, retval = %d\n", *ptr, retval));
   1.400 -  *ptr += sizeof(ULONG);
   1.401 -  return retval;
   1.402 -}
   1.403 -
   1.404 -static __inline PCHAR
   1.405 -__GET_XEN_INIT_STRING(PUCHAR *ptr)
   1.406 -{
   1.407 -  PCHAR retval;
   1.408 -  retval = (PCHAR)*ptr;
   1.409 -//  KdPrint((__DRIVER_NAME "     GET_XEN_INIT_STRING *ptr = %p, retval = %s\n", *ptr, retval));
   1.410 -  *ptr += strlen((PCHAR)*ptr) + 1;
   1.411 -  return retval;
   1.412 -}
   1.413 -
   1.414 -static __inline PVOID
   1.415 -__GET_XEN_INIT_PTR(PUCHAR *ptr)
   1.416 -{
   1.417 -  PVOID retval;
   1.418 -  retval = *(PVOID *)(*ptr);
   1.419 -//  KdPrint((__DRIVER_NAME "     GET_XEN_INIT_PTR *ptr = %p, retval = %p\n", *ptr, retval));
   1.420 -  *ptr += sizeof(PVOID);
   1.421 -  return retval;
   1.422 -}
   1.423 -
   1.424 -static __inline VOID
   1.425 -ADD_XEN_INIT_REQ(PUCHAR *ptr, UCHAR type, PVOID p1, PVOID p2, PVOID p3)
   1.426 -{
   1.427 -  __ADD_XEN_INIT_UCHAR(ptr, type);
   1.428 -  switch (type)
   1.429 -  {
   1.430 -  case XEN_INIT_TYPE_END:
   1.431 -  case XEN_INIT_TYPE_VECTORS:
   1.432 -  case XEN_INIT_TYPE_STATE_PTR:
   1.433 -  case XEN_INIT_TYPE_QEMU_PROTOCOL_VERSION:
   1.434 -  case XEN_INIT_TYPE_QEMU_HIDE_FLAGS:
   1.435 -  case XEN_INIT_TYPE_QEMU_HIDE_FILTER:
   1.436 -  case XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT:
   1.437 -  case XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT:
   1.438 -  case XEN_INIT_TYPE_XB_STATE_MAP_SHUTDOWN:
   1.439 -    break;
   1.440 -  case XEN_INIT_TYPE_WRITE_STRING:
   1.441 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.442 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p2);
   1.443 -    break;
   1.444 -  case XEN_INIT_TYPE_RING:
   1.445 -  case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ:
   1.446 -  case XEN_INIT_TYPE_READ_STRING_FRONT:
   1.447 -  case XEN_INIT_TYPE_READ_STRING_BACK:
   1.448 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.449 -    break;
   1.450 -  case XEN_INIT_TYPE_EVENT_CHANNEL:
   1.451 -  case XEN_INIT_TYPE_EVENT_CHANNEL_DPC:
   1.452 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.453 -    __ADD_XEN_INIT_PTR(ptr, p2);
   1.454 -    __ADD_XEN_INIT_PTR(ptr, p3);
   1.455 -    break;
   1.456 -  case XEN_INIT_TYPE_GRANT_ENTRIES:
   1.457 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p1));
   1.458 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
   1.459 -    break;
   1.460 -//  case XEN_INIT_TYPE_COPY_PTR:
   1.461 -//    __ADD_XEN_INIT_STRING(ptr, p1);
   1.462 -//    __ADD_XEN_INIT_PTR(ptr, p2);
   1.463 -//    break;
   1.464 -  }
   1.465 -}
   1.466 -
   1.467 -static __inline UCHAR
   1.468 -GET_XEN_INIT_REQ(PUCHAR *ptr, PVOID *p1, PVOID *p2, PVOID *p3)
   1.469 -{
   1.470 -  UCHAR retval;
   1.471 -
   1.472 -  retval = __GET_XEN_INIT_UCHAR(ptr);
   1.473 -  switch (retval)
   1.474 -  {
   1.475 -  case XEN_INIT_TYPE_END:
   1.476 -  case XEN_INIT_TYPE_VECTORS:
   1.477 -  case XEN_INIT_TYPE_STATE_PTR:
   1.478 -  case XEN_INIT_TYPE_QEMU_PROTOCOL_VERSION:
   1.479 -  case XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT:
   1.480 -  case XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT:
   1.481 -  case XEN_INIT_TYPE_XB_STATE_MAP_SHUTDOWN:
   1.482 -    *p1 = NULL;
   1.483 -    *p2 = NULL;
   1.484 -    break;
   1.485 -  case XEN_INIT_TYPE_WRITE_STRING:
   1.486 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.487 -    *p2 = __GET_XEN_INIT_STRING(ptr);
   1.488 -    break;
   1.489 -  case XEN_INIT_TYPE_RING:
   1.490 -  case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ:
   1.491 -  case XEN_INIT_TYPE_READ_STRING_FRONT:
   1.492 -  case XEN_INIT_TYPE_READ_STRING_BACK:
   1.493 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.494 -    *p2 = NULL;
   1.495 -    break;
   1.496 -  case XEN_INIT_TYPE_EVENT_CHANNEL:
   1.497 -  case XEN_INIT_TYPE_EVENT_CHANNEL_DPC:
   1.498 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.499 -    *p2 = __GET_XEN_INIT_PTR(ptr);
   1.500 -    *p3 = __GET_XEN_INIT_PTR(ptr);
   1.501 -    break;
   1.502 -  case XEN_INIT_TYPE_GRANT_ENTRIES:
   1.503 -    *p1 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.504 -    *p2 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.505 -    break;
   1.506 -  }
   1.507 -  return retval;
   1.508 -}
   1.509 -
   1.510 -static __inline VOID
   1.511 -ADD_XEN_INIT_RSP(PUCHAR *ptr, UCHAR type, PVOID p1, PVOID p2, PVOID p3)
   1.512 -{
   1.513 -  UNREFERENCED_PARAMETER(p3);
   1.514 -
   1.515 -  __ADD_XEN_INIT_UCHAR(ptr, type);
   1.516 -  switch (type)
   1.517 -  {
   1.518 -  case XEN_INIT_TYPE_END:
   1.519 -  case XEN_INIT_TYPE_WRITE_STRING: /* this shouldn't happen */
   1.520 -  case XEN_INIT_TYPE_QEMU_HIDE_FILTER:
   1.521 -    break;
   1.522 -  case XEN_INIT_TYPE_RING:
   1.523 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.524 -    __ADD_XEN_INIT_PTR(ptr, p2);
   1.525 -    break;
   1.526 -  case XEN_INIT_TYPE_EVENT_CHANNEL:
   1.527 -  case XEN_INIT_TYPE_EVENT_CHANNEL_DPC:
   1.528 -  case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ:
   1.529 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.530 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
   1.531 -    break;
   1.532 -  case XEN_INIT_TYPE_READ_STRING_FRONT:
   1.533 -  case XEN_INIT_TYPE_READ_STRING_BACK:
   1.534 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p1);
   1.535 -    __ADD_XEN_INIT_STRING(ptr, (PCHAR) p2);
   1.536 -    break;
   1.537 -  case XEN_INIT_TYPE_VECTORS:
   1.538 -    //__ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p1));
   1.539 -    memcpy(*ptr, p2, sizeof(XENPCI_VECTORS));
   1.540 -    *ptr += sizeof(XENPCI_VECTORS);
   1.541 -    break;
   1.542 -  case XEN_INIT_TYPE_GRANT_ENTRIES:
   1.543 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p1));
   1.544 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
   1.545 -    memcpy(*ptr, p3, PtrToUlong(p2) * sizeof(grant_entry_t));
   1.546 -    *ptr += PtrToUlong(p2) * sizeof(grant_entry_t);
   1.547 -    break;
   1.548 -  case XEN_INIT_TYPE_QEMU_HIDE_FLAGS:
   1.549 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
   1.550 -    break;
   1.551 -  case XEN_INIT_TYPE_STATE_PTR:
   1.552 -    __ADD_XEN_INIT_PTR(ptr, p2);
   1.553 -    break;
   1.554 -  case XEN_INIT_TYPE_QEMU_PROTOCOL_VERSION:
   1.555 -    __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
   1.556 -    break;
   1.557 -  }
   1.558 -}
   1.559 -
   1.560 -static __inline UCHAR
   1.561 -GET_XEN_INIT_RSP(PUCHAR *ptr, PVOID *p1, PVOID *p2, PVOID *p3)
   1.562 -{
   1.563 -  UCHAR retval;
   1.564 -
   1.565 -  UNREFERENCED_PARAMETER(p3);
   1.566 -
   1.567 -  retval = __GET_XEN_INIT_UCHAR(ptr);
   1.568 -  switch (retval)
   1.569 -  {
   1.570 -  case XEN_INIT_TYPE_END:
   1.571 -  case XEN_INIT_TYPE_QEMU_HIDE_FILTER:
   1.572 -    *p1 = NULL;
   1.573 -    *p2 = NULL;
   1.574 -    break;
   1.575 -  case XEN_INIT_TYPE_WRITE_STRING:
   1.576 -    // this shouldn't happen - no response here
   1.577 -    break;
   1.578 -  case XEN_INIT_TYPE_RING:
   1.579 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.580 -    *p2 = __GET_XEN_INIT_PTR(ptr);
   1.581 -    break;
   1.582 -  case XEN_INIT_TYPE_EVENT_CHANNEL:
   1.583 -  case XEN_INIT_TYPE_EVENT_CHANNEL_DPC:
   1.584 -  case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ:
   1.585 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.586 -    *p2 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.587 -    break;
   1.588 -  case XEN_INIT_TYPE_READ_STRING_FRONT:
   1.589 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.590 -    *p2 = __GET_XEN_INIT_STRING(ptr);
   1.591 -    break;
   1.592 -  case XEN_INIT_TYPE_READ_STRING_BACK:
   1.593 -    *p1 = __GET_XEN_INIT_STRING(ptr);
   1.594 -    *p2 = __GET_XEN_INIT_STRING(ptr);
   1.595 -    break;
   1.596 -  case XEN_INIT_TYPE_VECTORS:
   1.597 -    *p1 = NULL;
   1.598 -    *p2 = *ptr;
   1.599 -    *ptr += ((PXENPCI_VECTORS)*p2)->length;
   1.600 -    break;
   1.601 -  case XEN_INIT_TYPE_GRANT_ENTRIES:
   1.602 -    *p1 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.603 -    *p2 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.604 -    *p3 = *ptr;
   1.605 -    *ptr += PtrToUlong(*p2) * sizeof(grant_ref_t);
   1.606 -    break;
   1.607 -  case XEN_INIT_TYPE_STATE_PTR:
   1.608 -    *p2 = __GET_XEN_INIT_PTR(ptr);
   1.609 -    break;
   1.610 -  case XEN_INIT_TYPE_QEMU_HIDE_FLAGS:
   1.611 -    *p2 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.612 -    break;
   1.613 -  case XEN_INIT_TYPE_QEMU_PROTOCOL_VERSION:
   1.614 -    *p2 = UlongToPtr(__GET_XEN_INIT_ULONG(ptr));
   1.615 -    break;
   1.616 -  }
   1.617 -  return retval;
   1.618 -}
   1.619 -
   1.620 -typedef BOOLEAN
   1.621 -(*PXEN_DMA_NEED_VIRTUAL_ADDRESS)(PIRP irp);
   1.622 -
   1.623 -typedef ULONG
   1.624 -(*PXEN_DMA_GET_ALIGNMENT)(PIRP irp);
   1.625 -
   1.626 -typedef struct {
   1.627 -  PXEN_DMA_NEED_VIRTUAL_ADDRESS need_virtual_address;
   1.628 -  PXEN_DMA_GET_ALIGNMENT get_alignment;
   1.629 -  ULONG max_sg_elements;
   1.630 -} dma_driver_extension_t;
   1.631 -
   1.632 -#endif
   1.633  #endif
   1.634 \ No newline at end of file