win-pvdrivers

changeset 670:b59c7dfdee9b

Updates to support latest pre-release version of pvusb. No longer compatible with current version.
author James Harper <james.harper@bendigoit.com.au>
date Wed Sep 23 17:06:30 2009 +1000 (2009-09-23)
parents 0351906626c2
children 1bae3638ab55
files common/include/public/io/usbif.h xenusb/xenusb.h xenusb/xenusb.rc xenusb/xenusb_devurb.c xenusb/xenusb_fdo.c xenusb/xenusb_hub.c xenusb/xenusb_huburb.c
line diff
     1.1 --- a/common/include/public/io/usbif.h	Wed Sep 23 17:06:05 2009 +1000
     1.2 +++ b/common/include/public/io/usbif.h	Wed Sep 23 17:06:30 2009 +1000
     1.3 @@ -1,4 +1,3 @@
     1.4 -
     1.5  /*
     1.6   * usbif.h
     1.7   *
     1.8 @@ -38,85 +37,106 @@
     1.9   *  bits 0-5 are specific bits for virtual USB driver.
    1.10   *  bits 7-31 are standard urb pipe.
    1.11   *
    1.12 - *  - port number(NEW): bits 0-4
    1.13 - *                              (USB_MAXCHILDREN is 31)
    1.14 + *  - port number(NEW):	bits 0-4
    1.15 + *  				(USB_MAXCHILDREN is 31)
    1.16   *
    1.17 - *  - operation flag(NEW):      bit 5
    1.18 - *                              (0 = submit urb,
    1.19 - *                               1 = unlink urb)
    1.20 + *  - operation flag(NEW):	bit 5
    1.21 + *  				(0 = submit urb,
    1.22 + *  				 1 = unlink urb)
    1.23   *
    1.24 - *  - direction:                bit 7
    1.25 - *                              (0 = Host-to-Device [Out]
    1.26 + *  - direction:		bit 7
    1.27 + *  				(0 = Host-to-Device [Out]
    1.28   *                           1 = Device-to-Host [In])
    1.29   *
    1.30 - *  - device address:   bits 8-14
    1.31 + *  - device address:	bits 8-14
    1.32   *
    1.33 - *  - endpoint:         bits 15-18
    1.34 + *  - endpoint:		bits 15-18
    1.35   *
    1.36 - *  - pipe type:                bits 30-31
    1.37 - *                              (00 = isochronous, 01 = interrupt,
    1.38 + *  - pipe type:		bits 30-31
    1.39 + *  				(00 = isochronous, 01 = interrupt,
    1.40   *                           10 = control, 11 = bulk)
    1.41   */
    1.42  #define usbif_pipeportnum(pipe) ((pipe) & 0x1f)
    1.43  #define usbif_setportnum_pipe(pipe,portnum) \
    1.44 -        ((pipe)|(portnum))
    1.45 +	((pipe)|(portnum))
    1.46  #define usbif_pipeunlink(pipe) ((pipe) & 0x20)
    1.47  #define usbif_setunlink_pipe(pipe) ((pipe)|(0x20))
    1.48  
    1.49  #define USBIF_BACK_MAX_PENDING_REQS (128)
    1.50 -#define USBIF_MAX_SEGMENTS_PER_REQUEST (10)
    1.51 +#define USBIF_MAX_SEGMENTS_PER_REQUEST (16)
    1.52  
    1.53 +/*
    1.54 + * RING for transferring urbs. 
    1.55 + */
    1.56  struct usbif_request_segment {
    1.57 -        grant_ref_t gref;
    1.58 -        uint16_t offset;
    1.59 -        uint16_t length;
    1.60 +	grant_ref_t gref;
    1.61 +	uint16_t offset;
    1.62 +	uint16_t length;
    1.63  };
    1.64  
    1.65 -struct usbif_request {
    1.66 -        uint16_t id; /* request id */
    1.67 -        uint16_t nr_buffer_segs; /* number of urb->transfer_buffer segments */
    1.68 -
    1.69 -        /* basic urb parameter */
    1.70 -        uint32_t pipe;
    1.71 -        uint16_t transfer_flags;
    1.72 -        uint16_t buffer_length;
    1.73 -        union {
    1.74 -                uint8_t ctrl[8]; /* setup_packet (Ctrl) */
    1.75 -
    1.76 -                struct {
    1.77 -                        uint16_t interval; /* maximum (1024*8) in usb core */
    1.78 -                        uint16_t start_frame; /* start frame */
    1.79 -                        uint16_t number_of_packets; /* number of ISO packet */
    1.80 -                        uint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */
    1.81 -                } isoc;
    1.82 -
    1.83 -                struct {
    1.84 -                        uint16_t interval; /* maximum (1024*8) in usb core */
    1.85 -                        uint16_t pad[3];
    1.86 -                } intr;
    1.87 +struct usbif_urb_request {
    1.88 +	uint16_t id; /* request id */
    1.89 +	uint16_t nr_buffer_segs; /* number of urb->transfer_buffer segments */
    1.90  
    1.91 -                struct {
    1.92 -                        uint16_t unlink_id; /* unlink request id */
    1.93 -                        uint16_t pad[3];
    1.94 -                } unlink;
    1.95 -
    1.96 -        } u;
    1.97 -
    1.98 -        /* urb data segments */
    1.99 -        struct usbif_request_segment seg[USBIF_MAX_SEGMENTS_PER_REQUEST];
   1.100 -};
   1.101 -typedef struct usbif_request usbif_request_t;
   1.102 +	/* basic urb parameter */
   1.103 +	uint32_t pipe;
   1.104 +	uint16_t transfer_flags;
   1.105 +	uint16_t buffer_length;
   1.106 +	union {
   1.107 +		uint8_t ctrl[8]; /* setup_packet (Ctrl) */
   1.108  
   1.109 -struct usbif_response {
   1.110 -        uint16_t id; /* request id */
   1.111 -        uint16_t start_frame;  /* start frame (ISO) */
   1.112 -        int32_t status; /* status (non-ISO) */
   1.113 -        int32_t actual_length; /* actual transfer length */
   1.114 -        int32_t error_count; /* number of ISO errors */
   1.115 +		struct {
   1.116 +			uint16_t interval; /* maximum (1024*8) in usb core */
   1.117 +			uint16_t start_frame; /* start frame */
   1.118 +			uint16_t number_of_packets; /* number of ISO packet */
   1.119 +			uint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */
   1.120 +		} isoc;
   1.121 +
   1.122 +		struct {
   1.123 +			uint16_t interval; /* maximum (1024*8) in usb core */
   1.124 +			uint16_t pad[3];
   1.125 +		} intr;
   1.126 +
   1.127 +		struct {
   1.128 +			uint16_t unlink_id; /* unlink request id */
   1.129 +			uint16_t pad[3];
   1.130 +		} unlink;
   1.131 +
   1.132 +	} u;
   1.133 +
   1.134 +	/* urb data segments */
   1.135 +	struct usbif_request_segment seg[USBIF_MAX_SEGMENTS_PER_REQUEST];
   1.136  };
   1.137 -typedef struct usbif_response usbif_response_t;
   1.138 +typedef struct usbif_urb_request usbif_urb_request_t;
   1.139  
   1.140 -DEFINE_RING_TYPES(usbif, struct usbif_request, struct usbif_response);
   1.141 -#define USB_RING_SIZE __RING_SIZE((struct usbif_sring *)0, PAGE_SIZE)
   1.142 +struct usbif_urb_response {
   1.143 +	uint16_t id; /* request id */
   1.144 +	uint16_t start_frame;  /* start frame (ISO) */
   1.145 +	int32_t status; /* status (non-ISO) */
   1.146 +	int32_t actual_length; /* actual transfer length */
   1.147 +	int32_t error_count; /* number of ISO errors */
   1.148 +};
   1.149 +typedef struct usbif_urb_response usbif_urb_response_t;
   1.150  
   1.151 -#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
   1.152 \ No newline at end of file
   1.153 +DEFINE_RING_TYPES(usbif_urb, struct usbif_urb_request, struct usbif_urb_response);
   1.154 +#define USB_URB_RING_SIZE __RING_SIZE((struct usbif_urb_sring *)0, PAGE_SIZE)
   1.155 +
   1.156 +/*
   1.157 + * RING for notifying connect/disconnect events to frontend
   1.158 + */
   1.159 +struct usbif_conn_request {
   1.160 +	uint16_t id;
   1.161 +};
   1.162 +typedef struct usbif_conn_request usbif_conn_request_t;
   1.163 +
   1.164 +struct usbif_conn_response {
   1.165 +	uint16_t id; /* request id */
   1.166 +	uint8_t portnum; /* port number */
   1.167 +	uint8_t speed; /* usb_device_speed */ 
   1.168 +};
   1.169 +typedef struct usbif_conn_response usbif_conn_response_t;
   1.170 +
   1.171 +DEFINE_RING_TYPES(usbif_conn, struct usbif_conn_request, struct usbif_conn_response);
   1.172 +#define USB_CONN_RING_SIZE __RING_SIZE((struct usbif_conn_sring *)0, PAGE_SIZE)
   1.173 +
   1.174 +#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
     2.1 --- a/xenusb/xenusb.h	Wed Sep 23 17:06:05 2009 +1000
     2.2 +++ b/xenusb/xenusb.h	Wed Sep 23 17:06:30 2009 +1000
     2.3 @@ -116,13 +116,13 @@ struct _usbif_shadow {
     2.4    ULONG total_length;
     2.5    /* called at DISPATCH_LEVEL */
     2.6    VOID (*callback)(usbif_shadow_t *);
     2.7 -  usbif_request_t req;
     2.8 -  usbif_response_t rsp;
     2.9 +  usbif_urb_request_t req;
    2.10 +  usbif_urb_response_t rsp;
    2.11    usbif_shadow_t *next; /* for gathering shadows from the ring for callback */
    2.12  };
    2.13  
    2.14  #define MAX_SHADOW_ENTRIES 64
    2.15 -#define SHADOW_ENTRIES min(MAX_SHADOW_ENTRIES, USB_RING_SIZE)
    2.16 +#define SHADOW_ENTRIES min(MAX_SHADOW_ENTRIES, USB_URB_RING_SIZE)
    2.17  
    2.18  struct _xenusb_endpoint_t;
    2.19  struct _xenusb_interface_t;
    2.20 @@ -196,14 +196,19 @@ typedef struct {
    2.21    USHORT shadow_free;
    2.22  
    2.23    PUCHAR config_page;
    2.24 -  
    2.25 -  KSPIN_LOCK port_lock;
    2.26 +
    2.27 +  /* protected by conn_ring_lock */  
    2.28    ULONG num_ports;
    2.29    xenusb_port_t ports[32];
    2.30  
    2.31 -  KSPIN_LOCK ring_lock;
    2.32 -  usbif_sring_t *sring;
    2.33 -  usbif_front_ring_t ring;
    2.34 +  KSPIN_LOCK urb_ring_lock;
    2.35 +  usbif_urb_sring_t *urb_sring;
    2.36 +  usbif_urb_front_ring_t urb_ring;
    2.37 +
    2.38 +  KSPIN_LOCK conn_ring_lock;
    2.39 +  usbif_conn_sring_t *conn_sring;
    2.40 +  usbif_conn_front_ring_t conn_ring;
    2.41 +
    2.42    evtchn_port_t event_channel;
    2.43  
    2.44    BOOLEAN inactive;
     3.1 --- a/xenusb/xenusb.rc	Wed Sep 23 17:06:05 2009 +1000
     3.2 +++ b/xenusb/xenusb.rc	Wed Sep 23 17:06:30 2009 +1000
     3.3 @@ -1,6 +1,6 @@
     3.4  #include <windows.h>
     3.5 -
     3.6  #include <ntverp.h>
     3.7 +#include "gplpv_version.h"
     3.8  
     3.9  #define VER_FILETYPE                VFT_DRV
    3.10  #define VER_FILESUBTYPE             VFT2_DRV_SYSTEM
    3.11 @@ -12,17 +12,6 @@
    3.12  #define VER_INTERNALNAME_STR        "xenpci.sys"
    3.13  #define VER_ORIGINALFILENAME_STR    "xenpci.sys"
    3.14  
    3.15 -#define EXPAND(x) STRINGIFY(x)
    3.16 -#define STRINGIFY(x) #x
    3.17 -
    3.18 -#ifdef BUILD_NUMBER
    3.19 -  #define VER_FILEVERSION             0,10,0,BUILD_NUMBER
    3.20 -  #define VER_FILEVERSION_STR         "GPLPV 0.10.0." EXPAND(BUILD_NUMBER)
    3.21 -#else
    3.22 -  #define VER_FILEVERSION             0,0,0,0
    3.23 -  #define VER_FILEVERSION_STR         "GPLPV Unversioned"
    3.24 -#endif
    3.25 -
    3.26  #undef VER_PRODUCTVERSION
    3.27  #define VER_PRODUCTVERSION          VER_FILEVERSION
    3.28  #undef VER_PRODUCTVERSION_STR
     4.1 --- a/xenusb/xenusb_devurb.c	Wed Sep 23 17:06:05 2009 +1000
     4.2 +++ b/xenusb/xenusb_devurb.c	Wed Sep 23 17:06:30 2009 +1000
     4.3 @@ -26,7 +26,6 @@ XenUsb_UrbCallback(usbif_shadow_t *shado
     4.4  {
     4.5    WDFQUEUE queue;
     4.6    WDFDEVICE device;
     4.7 -  PXENUSB_PDO_DEVICE_DATA xupdd;
     4.8    PXENUSB_DEVICE_DATA xudd;
     4.9    //ULONG i;
    4.10  
    4.11 @@ -37,8 +36,7 @@ XenUsb_UrbCallback(usbif_shadow_t *shado
    4.12    ASSERT(queue);
    4.13    device = WdfIoQueueGetDevice(queue);
    4.14    ASSERT(device);
    4.15 -  xupdd = GetXupdd(device);
    4.16 -  xudd = GetXudd(xupdd->wdf_device_bus_fdo);
    4.17 +  xudd = GetXudd(device);
    4.18  
    4.19    switch (shadow->urb->UrbHeader.Function)
    4.20    {
    4.21 @@ -56,15 +54,14 @@ XenUsb_UrbCallback(usbif_shadow_t *shado
    4.22    //case URB_FUNCTION_SET_DESCRIPTOR_TO_INTERFACE:
    4.23      KdPrint((__DRIVER_NAME "     URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE\n"));
    4.24      shadow->urb->UrbControlDescriptorRequest.TransferBufferLength = shadow->total_length;
    4.25 -#if 0
    4.26  {
    4.27    PUCHAR addr = shadow->urb->UrbControlDescriptorRequest.TransferBuffer;
    4.28 +  int i;
    4.29    if (!addr)
    4.30      addr = MmGetSystemAddressForMdlSafe(shadow->urb->UrbControlDescriptorRequest.TransferBufferMDL, HighPagePriority);
    4.31    for (i = 0; i < min(shadow->urb->UrbControlDescriptorRequest.TransferBufferLength, 16); i++)
    4.32 -    KdPrint((__DRIVER_NAME "      UrbControlDescriptorRequest[%02x] = %02x\n", i, addr[i]));
    4.33 +    KdPrint((__DRIVER_NAME "      UrbControlDescriptorRequest[%02x] = %02x '%c'\n", i, addr[i], (addr[i] < 32)?' ':addr[i]));
    4.34  }
    4.35 -#endif
    4.36      break;
    4.37    case URB_FUNCTION_SELECT_CONFIGURATION:
    4.38      KdPrint((__DRIVER_NAME "     rsp id = %d\n", shadow->rsp.id));
    4.39 @@ -95,6 +92,15 @@ XenUsb_UrbCallback(usbif_shadow_t *shado
    4.40      shadow->urb->UrbControlVendorClassRequest.TransferBufferLength = shadow->total_length;
    4.41      break;
    4.42    case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
    4.43 +#if 0
    4.44 +    KdPrint((__DRIVER_NAME "     rsp id = %d\n", shadow->rsp.id));
    4.45 +    KdPrint((__DRIVER_NAME "     rsp start_frame = %d\n", shadow->rsp.start_frame));
    4.46 +    KdPrint((__DRIVER_NAME "     rsp status = %d\n", shadow->rsp.status));
    4.47 +    KdPrint((__DRIVER_NAME "     rsp actual_length = %d\n", shadow->rsp.actual_length));
    4.48 +    KdPrint((__DRIVER_NAME "     rsp error_count = %d\n", shadow->rsp.error_count));
    4.49 +    KdPrint((__DRIVER_NAME "     total_length = %d\n", shadow->total_length));
    4.50 +    KdPrint((__DRIVER_NAME "     URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n"));
    4.51 +#endif
    4.52      shadow->urb->UrbBulkOrInterruptTransfer.TransferBufferLength = shadow->total_length;
    4.53      break;
    4.54    default:
    4.55 @@ -149,8 +155,7 @@ XenUsb_EvtIoInternalDeviceControl_DEVICE
    4.56  {
    4.57    NTSTATUS status;
    4.58    WDFDEVICE device = WdfIoQueueGetDevice(queue);
    4.59 -  PXENUSB_PDO_DEVICE_DATA xupdd = GetXupdd(device);
    4.60 -  PXENUSB_DEVICE_DATA xudd = GetXudd(xupdd->wdf_device_bus_fdo);
    4.61 +  PXENUSB_DEVICE_DATA xudd = GetXudd(device);
    4.62    WDF_REQUEST_PARAMETERS wrp;
    4.63    PURB urb;
    4.64    usbif_shadow_t *shadow;
    4.65 @@ -188,9 +193,6 @@ XenUsb_EvtIoInternalDeviceControl_DEVICE
    4.66  
    4.67    ASSERT(usb_device);
    4.68    
    4.69 -  if (!usb_device)
    4.70 -    usb_device = xupdd->usb_device;
    4.71 -
    4.72    switch(urb->UrbHeader.Function)
    4.73    {
    4.74    case URB_FUNCTION_SELECT_CONFIGURATION:
    4.75 @@ -556,7 +558,7 @@ XenUsb_EvtIoInternalDeviceControl_DEVICE
    4.76        WdfRequestComplete(request, STATUS_SUCCESS);
    4.77        break;
    4.78      default:
    4.79 -      KdPrint((__DRIVER_NAME "      TransferFlags = %08x\n", urb->UrbControlVendorClassRequest.TransferFlags));
    4.80 +URB_FUNCTION_GET_DESCRIPTOR_FROM_DEVICE      KdPrint((__DRIVER_NAME "      TransferFlags = %08x\n", urb->UrbControlVendorClassRequest.TransferFlags));
    4.81        KdPrint((__DRIVER_NAME "      TransferBufferLength = %d\n", urb->UrbControlVendorClassRequest.TransferBufferLength));
    4.82        KdPrint((__DRIVER_NAME "      TransferBuffer = %p\n", urb->UrbControlVendorClassRequest.TransferBuffer));
    4.83        KdPrint((__DRIVER_NAME "      TransferBufferMDL = %p\n", urb->UrbControlVendorClassRequest.TransferBufferMDL));
    4.84 @@ -705,26 +707,6 @@ XenUsb_EvtIoInternalDeviceControl_DEVICE
    4.85      break;
    4.86  #endif
    4.87    case URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: /* 11.12.4 */
    4.88 -#if 0
    4.89 -    KdPrint((__DRIVER_NAME "     URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER\n"));
    4.90 -    KdPrint((__DRIVER_NAME "      PipeHandle = %p\n", urb->UrbBulkOrInterruptTransfer.PipeHandle));
    4.91 -#endif
    4.92 -//    KdPrint((__DRIVER_NAME "      TransferFlags = %08x\n", urb->UrbBulkOrInterruptTransfer.TransferFlags));
    4.93 -//    KdPrint((__DRIVER_NAME "      TransferBufferLength = %d\n", urb->UrbBulkOrInterruptTransfer.TransferBufferLength));
    4.94 -#if 0
    4.95 -    KdPrint((__DRIVER_NAME "      TransferBuffer = %p\n", urb->UrbBulkOrInterruptTransfer.TransferBuffer));
    4.96 -    KdPrint((__DRIVER_NAME "      TransferBufferMdl = %p\n", urb->UrbBulkOrInterruptTransfer.TransferBufferMDL));
    4.97 -    KdPrint((__DRIVER_NAME "      UrbLink = %p\n", urb->UrbBulkOrInterruptTransfer.UrbLink));
    4.98 -#endif
    4.99 -#if 0
   4.100 -{
   4.101 -  PUCHAR addr = urb->UrbBulkOrInterruptTransfer.TransferBuffer;
   4.102 -  if (!addr)
   4.103 -    addr = MmGetSystemAddressForMdlSafe(urb->UrbBulkOrInterruptTransfer.TransferBufferMDL, HighPagePriority);
   4.104 -  for (i = 0; i < min(urb->UrbBulkOrInterruptTransfer.TransferBufferLength, 16); i++)
   4.105 -    KdPrint((__DRIVER_NAME "      UrbBulkOrInterruptTransfer[%02x] = %02x\n", i, addr[i]));
   4.106 -}
   4.107 -#endif
   4.108      endpoint = urb->UrbBulkOrInterruptTransfer.PipeHandle;    
   4.109  //    KdPrint((__DRIVER_NAME "      pipe_value = %08x\n", endpoint->pipe_value));
   4.110      shadow = get_shadow_from_freelist(xudd);
     5.1 --- a/xenusb/xenusb_fdo.c	Wed Sep 23 17:06:05 2009 +1000
     5.2 +++ b/xenusb/xenusb_fdo.c	Wed Sep 23 17:06:30 2009 +1000
     5.3 @@ -50,16 +50,16 @@ XenUsb_ExecuteRequestCallback(
     5.4    //KdPrint((__DRIVER_NAME "     buffer_length = %d\n", shadow->req.buffer_length));
     5.5    //KdPrint((__DRIVER_NAME "     nr_buffer_segs = %d\n", shadow->req.nr_buffer_segs));
     5.6  
     5.7 -  KeAcquireSpinLock(&xudd->ring_lock, &old_irql);
     5.8 -  *RING_GET_REQUEST(&xudd->ring, xudd->ring.req_prod_pvt) = shadow->req;
     5.9 -  xudd->ring.req_prod_pvt++;
    5.10 -  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xudd->ring, notify);
    5.11 +  KeAcquireSpinLock(&xudd->urb_ring_lock, &old_irql);
    5.12 +  *RING_GET_REQUEST(&xudd->urb_ring, xudd->urb_ring.req_prod_pvt) = shadow->req;
    5.13 +  xudd->urb_ring.req_prod_pvt++;
    5.14 +  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xudd->urb_ring, notify);
    5.15    if (notify)
    5.16    {
    5.17      //KdPrint((__DRIVER_NAME "     Notifying\n"));
    5.18      xudd->vectors.EvtChn_Notify(xudd->vectors.context, xudd->event_channel);
    5.19    }
    5.20 -  KeReleaseSpinLock(&xudd->ring_lock, old_irql);
    5.21 +  KeReleaseSpinLock(&xudd->urb_ring_lock, old_irql);
    5.22  
    5.23    //FUNCTION_EXIT();
    5.24    
    5.25 @@ -90,16 +90,16 @@ XenUsb_ExecuteRequest(
    5.26      shadow->req.nr_buffer_segs = 0;
    5.27      shadow->req.buffer_length = 0;
    5.28  
    5.29 -    KeAcquireSpinLock(&xudd->ring_lock, &old_irql);
    5.30 -    *RING_GET_REQUEST(&xudd->ring, xudd->ring.req_prod_pvt) = shadow->req;
    5.31 -    xudd->ring.req_prod_pvt++;
    5.32 -    RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xudd->ring, notify);
    5.33 +    KeAcquireSpinLock(&xudd->urb_ring_lock, &old_irql);
    5.34 +    *RING_GET_REQUEST(&xudd->urb_ring, xudd->urb_ring.req_prod_pvt) = shadow->req;
    5.35 +    xudd->urb_ring.req_prod_pvt++;
    5.36 +    RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xudd->urb_ring, notify);
    5.37      if (notify)
    5.38      {
    5.39        //KdPrint((__DRIVER_NAME "     Notifying\n"));
    5.40        xudd->vectors.EvtChn_Notify(xudd->vectors.context, xudd->event_channel);
    5.41      }
    5.42 -    KeReleaseSpinLock(&xudd->ring_lock, old_irql);
    5.43 +    KeReleaseSpinLock(&xudd->urb_ring_lock, old_irql);
    5.44      //FUNCTION_EXIT();
    5.45      return STATUS_SUCCESS;
    5.46    }
    5.47 @@ -243,26 +243,29 @@ XenUsb_HandleEvent(PVOID context)
    5.48  {
    5.49    PXENUSB_DEVICE_DATA xudd = context;
    5.50    RING_IDX prod, cons;
    5.51 -  usbif_response_t *rsp;
    5.52 -  int more_to_do = TRUE;
    5.53 +  usbif_urb_response_t *urb_rsp;
    5.54 +  usbif_conn_response_t *conn_rsp;
    5.55 +  usbif_conn_request_t *conn_req;
    5.56 +  int more_to_do;
    5.57    usbif_shadow_t *complete_head = NULL, *complete_tail = NULL;
    5.58    usbif_shadow_t *shadow;
    5.59  
    5.60    //FUNCTION_ENTER();
    5.61  
    5.62 -  KeAcquireSpinLockAtDpcLevel(&xudd->ring_lock);
    5.63 +  more_to_do = TRUE;
    5.64 +  KeAcquireSpinLockAtDpcLevel(&xudd->urb_ring_lock);
    5.65    while (more_to_do)
    5.66    {
    5.67 -    prod = xudd->ring.sring->rsp_prod;
    5.68 +    prod = xudd->urb_ring.sring->rsp_prod;
    5.69      KeMemoryBarrier();
    5.70 -    for (cons = xudd->ring.rsp_cons; cons != prod; cons++)
    5.71 +    for (cons = xudd->urb_ring.rsp_cons; cons != prod; cons++)
    5.72      {
    5.73 -      rsp = RING_GET_RESPONSE(&xudd->ring, cons);
    5.74 -      shadow = &xudd->shadows[rsp->id];
    5.75 +      urb_rsp = RING_GET_RESPONSE(&xudd->urb_ring, cons);
    5.76 +      shadow = &xudd->shadows[urb_rsp->id];
    5.77        ASSERT(shadow->callback);
    5.78 -      shadow->rsp = *rsp;
    5.79 +      shadow->rsp = *urb_rsp;
    5.80        shadow->next = NULL;
    5.81 -      shadow->total_length += rsp->actual_length;
    5.82 +      shadow->total_length += urb_rsp->actual_length;
    5.83  #if 0
    5.84        KdPrint((__DRIVER_NAME "     rsp id = %d\n", shadow->rsp.id));
    5.85        KdPrint((__DRIVER_NAME "     rsp start_frame = %d\n", shadow->rsp.start_frame));
    5.86 @@ -282,18 +285,68 @@ XenUsb_HandleEvent(PVOID context)
    5.87        complete_tail = shadow;
    5.88      }
    5.89  
    5.90 -    xudd->ring.rsp_cons = cons;
    5.91 -    if (cons != xudd->ring.req_prod_pvt)
    5.92 +    xudd->urb_ring.rsp_cons = cons;
    5.93 +    if (cons != xudd->urb_ring.req_prod_pvt)
    5.94      {
    5.95 -      RING_FINAL_CHECK_FOR_RESPONSES(&xudd->ring, more_to_do);
    5.96 +      RING_FINAL_CHECK_FOR_RESPONSES(&xudd->urb_ring, more_to_do);
    5.97      }
    5.98      else
    5.99      {
   5.100 -      xudd->ring.sring->rsp_event = cons + 1;
   5.101 +      xudd->urb_ring.sring->rsp_event = cons + 1;
   5.102        more_to_do = FALSE;
   5.103      }
   5.104    }
   5.105 -  KeReleaseSpinLockFromDpcLevel(&xudd->ring_lock);
   5.106 +  KeReleaseSpinLockFromDpcLevel(&xudd->urb_ring_lock);
   5.107 +
   5.108 +  more_to_do = TRUE;
   5.109 +  KeAcquireSpinLockAtDpcLevel(&xudd->conn_ring_lock);
   5.110 +  while (more_to_do)
   5.111 +  {
   5.112 +    prod = xudd->conn_ring.sring->rsp_prod;
   5.113 +    KeMemoryBarrier();
   5.114 +    for (cons = xudd->conn_ring.rsp_cons; cons != prod; cons++)
   5.115 +    {
   5.116 +      conn_rsp = RING_GET_RESPONSE(&xudd->conn_ring, cons);
   5.117 +      KdPrint((__DRIVER_NAME "     conn_rsp->portnum = %d\n", conn_rsp->portnum));
   5.118 +      KdPrint((__DRIVER_NAME "     conn_rsp->speed = %d\n", conn_rsp->speed));
   5.119 +      
   5.120 +      xudd->ports[conn_rsp->portnum].port_type = conn_rsp->speed;
   5.121 +      switch (conn_rsp->speed)
   5.122 +      {
   5.123 +      case USB_PORT_TYPE_NOT_CONNECTED:
   5.124 +        xudd->ports[conn_rsp->portnum].port_status = (1 << PORT_ENABLE);
   5.125 +        break;
   5.126 +      case USB_PORT_TYPE_LOW_SPEED:
   5.127 +        xudd->ports[conn_rsp->portnum].port_status = (1 << PORT_LOW_SPEED) | (1 << PORT_CONNECTION) | (1 << PORT_ENABLE);
   5.128 +        break;
   5.129 +      case USB_PORT_TYPE_FULL_SPEED:
   5.130 +        xudd->ports[conn_rsp->portnum].port_status = (1 << PORT_CONNECTION) | (1 << PORT_ENABLE);
   5.131 +        break;
   5.132 +      case USB_PORT_TYPE_HIGH_SPEED:
   5.133 +        xudd->ports[conn_rsp->portnum].port_status = (1 << PORT_HIGH_SPEED) | (1 << PORT_CONNECTION) | (1 << PORT_ENABLE);
   5.134 +        break;
   5.135 +      }      
   5.136 +      xudd->ports[conn_rsp->portnum].port_change |= (1 << PORT_CONNECTION);
   5.137 +      
   5.138 +      // notify pending interrupt urb?
   5.139 +      
   5.140 +      conn_req = RING_GET_REQUEST(&xudd->conn_ring, xudd->conn_ring.req_prod_pvt);
   5.141 +      conn_req->id = conn_rsp->id;
   5.142 +      xudd->conn_ring.req_prod_pvt++;
   5.143 +    }
   5.144 +
   5.145 +    xudd->conn_ring.rsp_cons = cons;
   5.146 +    if (cons != xudd->conn_ring.req_prod_pvt)
   5.147 +    {
   5.148 +      RING_FINAL_CHECK_FOR_RESPONSES(&xudd->conn_ring, more_to_do);
   5.149 +    }
   5.150 +    else
   5.151 +    {
   5.152 +      xudd->conn_ring.sring->rsp_event = cons + 1;
   5.153 +      more_to_do = FALSE;
   5.154 +    }
   5.155 +  }
   5.156 +  KeReleaseSpinLockFromDpcLevel(&xudd->conn_ring_lock);
   5.157  
   5.158    shadow = complete_head;
   5.159    while (shadow != NULL)
   5.160 @@ -344,7 +397,7 @@ XenUsb_StartXenbusInit(PXENUSB_DEVICE_DA
   5.161    USHORT type;
   5.162    PCHAR setting, value, value2;
   5.163  
   5.164 -  xudd->sring = NULL;
   5.165 +  xudd->urb_sring = NULL;
   5.166    xudd->event_channel = 0;
   5.167  
   5.168    xudd->inactive = TRUE;
   5.169 @@ -406,10 +459,15 @@ XenUsb_CompleteXenbusInit(PXENUSB_DEVICE
   5.170      {
   5.171      case XEN_INIT_TYPE_RING: /* frontend ring */
   5.172        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_RING - %s = %p\n", setting, value));
   5.173 -      if (strcmp(setting, "ring-ref") == 0)
   5.174 +      if (strcmp(setting, "urb-ring-ref") == 0)
   5.175        {
   5.176 -        xudd->sring = (usbif_sring_t *)value;
   5.177 -        FRONT_RING_INIT(&xudd->ring, xudd->sring, PAGE_SIZE);
   5.178 +        xudd->urb_sring = (usbif_urb_sring_t *)value;
   5.179 +        FRONT_RING_INIT(&xudd->urb_ring, xudd->urb_sring, PAGE_SIZE);
   5.180 +      }
   5.181 +      if (strcmp(setting, "conn-ring-ref") == 0)
   5.182 +      {
   5.183 +        xudd->conn_sring = (usbif_conn_sring_t *)value;
   5.184 +        FRONT_RING_INIT(&xudd->conn_ring, xudd->conn_sring, PAGE_SIZE);
   5.185        }
   5.186        break;
   5.187      case XEN_INIT_TYPE_EVENT_CHANNEL_DPC: /* frontend event channel */
   5.188 @@ -428,7 +486,7 @@ XenUsb_CompleteXenbusInit(PXENUSB_DEVICE
   5.189        break;
   5.190      }
   5.191    }
   5.192 -  if (!xudd->inactive && (xudd->sring == NULL || xudd->event_channel == 0))
   5.193 +  if (!xudd->inactive && (xudd->urb_sring == NULL || xudd->conn_sring == NULL || xudd->event_channel == 0))
   5.194    {
   5.195      KdPrint((__DRIVER_NAME "     Missing settings\n"));
   5.196      KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   5.197 @@ -495,11 +553,54 @@ XenUsb_EvtDevicePrepareHardware(WDFDEVIC
   5.198      }
   5.199    }
   5.200  
   5.201 +#if 0
   5.202 +*** No owner thread found for resource 808a5920
   5.203 +*** No owner thread found for resource 808a5920
   5.204 +*** No owner thread found for resource 808a5920
   5.205 +*** No owner thread found for resource 808a5920
   5.206 +Probably caused by : USBSTOR.SYS ( USBSTOR!USBSTOR_SyncSendUsbRequest+77 )
   5.207 +
   5.208 +f78e27a4 8081df53 809c560e f78e27c4 809c560e nt!IovCallDriver+0x82
   5.209 +f78e27b0 809c560e 80a5ff00 82b431a8 00000000 nt!IofCallDriver+0x13
   5.210 +f78e27c4 809b550c 82b431a8 8454ef00 8454ef00 nt!ViFilterDispatchGeneric+0x2a
   5.211 +f78e27f4 8081df53 bac7818a f78e2808 bac7818a nt!IovCallDriver+0x112
   5.212 +f78e2800 bac7818a f78e282c bac79d3c 8454ef00 nt!IofCallDriver+0x13
   5.213 +f78e2808 bac79d3c 8454ef00 82b431a8 80a5ff00 usbhub!USBH_PassIrp+0x18
   5.214 +f78e282c bac79f08 822ea7c0 8454ef00 f78e286c usbhub!USBH_FdoDispatch+0x4c
   5.215 +f78e283c 809b550c 822ea708 8454ef00 8454efb0 usbhub!USBH_HubDispatch+0x5e
   5.216 +f78e286c 8081df53 809c560e f78e288c 809c560e nt!IovCallDriver+0x112
   5.217 +f78e2878 809c560e 80a5ff00 8233dad0 00000000 nt!IofCallDriver+0x13
   5.218 +f78e288c 809b550c 8233dad0 8454ef00 8454efd4 nt!ViFilterDispatchGeneric+0x2a
   5.219 +f78e28bc 8081df53 bac7c15e f78e28e0 bac7c15e nt!IovCallDriver+0x112
   5.220 +f78e28c8 bac7c15e 822ea7c0 81f98df8 8454ef00 nt!IofCallDriver+0x13
   5.221 +f78e28e0 bac7ca33 822ea7c0 8454ef00 80a5ff00 usbhub!USBH_PdoUrbFilter+0x14c
   5.222 +f78e2900 bac79ef2 8380cfb0 8454ef00 f78e2940 usbhub!USBH_PdoDispatch+0x211
   5.223 +f78e2910 809b550c 81f98d40 8454ef00 82334c80 usbhub!USBH_HubDispatch+0x48
   5.224 +f78e2940 8081df53 ba2ed27d f78e2978 ba2ed27d nt!IovCallDriver+0x112
   5.225 +f78e294c ba2ed27d 82334bc8 8380cfb0 82334c80 nt!IofCallDriver+0x13
   5.226 +f78e2978 ba2ed570 82334bc8 8380cfb0 00000000 USBSTOR!USBSTOR_SyncSendUsbRequest+0x77
   5.227 +f78e29ac ba2ee0a4 82334bc8 82334bc8 82334c80 USBSTOR!USBSTOR_SelectConfiguration+0x7e
   5.228 +f78e29ec ba2ee1e8 82334bc8 83caced8 80a5ff00 USBSTOR!USBSTOR_FdoStartDevice+0x68
   5.229 +f78e2a04 809b550c 82334bc8 83caced8 83cacffc USBSTOR!USBSTOR_Pnp+0x5a
   5.230 +f78e2a34 8081df53 8090d728 f78e2a6c 8090d728 nt!IovCallDriver+0x112
   5.231 +f78e2a40 8090d728 f78e2aac 81f98d40 00000000 nt!IofCallDriver+0x13
   5.232 +f78e2a6c 8090d7bb 82334bc8 f78e2a88 00000000 nt!IopSynchronousCall+0xb8
   5.233 +f78e2ab0 8090a684 81f98d40 823c71a8 00000001 nt!IopStartDevice+0x4d
   5.234 +f78e2acc 8090cd9d 81f98d40 00000001 823c71a8 nt!PipProcessStartPhase1+0x4e
   5.235 +f78e2d24 8090d21c 82403628 00000001 00000000 nt!PipProcessDevNodeTree+0x1db
   5.236 +f78e2d58 80823345 00000003 82d06020 808ae5fc nt!PiProcessReenumeration+0x60
   5.237 +f78e2d80 80880469 00000000 00000000 82d06020 nt!PipDeviceActionWorker+0x16b
   5.238 +f78e2dac 80949b7c 00000000 00000000 00000000 nt!ExpWorkerThread+0xeb
   5.239 +f78e2ddc 8088e092 8088037e 00000001 00000000 nt!PspSystemThreadStartup+0x2e
   5.240 +#endif
   5.241 +
   5.242    status = XenUsb_StartXenbusInit(xudd);
   5.243  
   5.244    ptr = xudd->config_page;
   5.245    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RUN, NULL, NULL, NULL);
   5.246 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "ring-ref", NULL, NULL);
   5.247 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RUN, NULL, NULL, NULL);
   5.248 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "urb-ring-ref", NULL, NULL);
   5.249 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "conn-ring-ref", NULL, NULL);
   5.250    #pragma warning(suppress:4054)
   5.251    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_DPC, "event-channel", (PVOID)XenUsb_HandleEvent, xudd);
   5.252    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL, NULL);
   5.253 @@ -516,6 +617,9 @@ NTSTATUS
   5.254  XenUsb_EvtDeviceD0Entry(WDFDEVICE device, WDF_POWER_DEVICE_STATE previous_state)
   5.255  {
   5.256    NTSTATUS status = STATUS_SUCCESS;
   5.257 +  PXENUSB_DEVICE_DATA xudd = GetXudd(device);
   5.258 +  ULONG i;
   5.259 +  int notify;
   5.260    //PXENUSB_DEVICE_DATA xudd = GetXudd(device);
   5.261  
   5.262    UNREFERENCED_PARAMETER(device);
   5.263 @@ -547,6 +651,20 @@ XenUsb_EvtDeviceD0Entry(WDFDEVICE device
   5.264      break;  
   5.265    }
   5.266  
   5.267 +  /* fill conn ring with requests */
   5.268 +  for (i = 0; i < USB_CONN_RING_SIZE; i++)
   5.269 +  {
   5.270 +    usbif_conn_request_t *req = RING_GET_REQUEST(&xudd->conn_ring, i);
   5.271 +    req->id = (uint16_t)i;
   5.272 +  }
   5.273 +  xudd->conn_ring.req_prod_pvt = i;
   5.274 +
   5.275 +  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xudd->urb_ring, notify);
   5.276 +  if (notify)
   5.277 +  {
   5.278 +    xudd->vectors.EvtChn_Notify(xudd->vectors.context, xudd->event_channel);
   5.279 +  }
   5.280 +  
   5.281    FUNCTION_EXIT();
   5.282  
   5.283    return status;
   5.284 @@ -661,13 +779,6 @@ XenUsb_EvtDeviceReleaseHardware(WDFDEVIC
   5.285    return status;
   5.286  }
   5.287  
   5.288 -#if 0
   5.289 -VOID
   5.290 -XenUsb_PrepareShadow(usbif_shadow_t *shadow, PVOID setup_packet, ULONG data_length)
   5.291 -{
   5.292 -}
   5.293 -#endif
   5.294 -
   5.295  VOID
   5.296  XenUsb_EvtChildListScanForChildren(WDFCHILDLIST child_list)
   5.297  {
   5.298 @@ -702,7 +813,7 @@ XenUsb_EvtChildListScanForChildren(WDFCH
   5.299    {
   5.300      xudd->ports[i].port_number = i + 1;
   5.301      xudd->ports[i].port_type = USB_PORT_TYPE_NOT_CONNECTED;
   5.302 -    xudd->ports[i].port_status = 0x0002;
   5.303 +    xudd->ports[i].port_status = 1 << PORT_ENABLE;
   5.304      xudd->ports[i].port_change = 0x0000;
   5.305    }  
   5.306  
   5.307 @@ -836,7 +947,7 @@ XenUsb_EvtIoDeviceControl(
   5.308      KdPrint((__DRIVER_NAME "      output_buffer_length = %d\n", output_buffer_length));
   5.309        
   5.310      if (output_buffer_length < sizeof(USB_HCD_DRIVERKEY_NAME))
   5.311 -      status = STATUS_INSUFFICIENT_RESOURCES;
   5.312 +      status = STATUS_BUFFER_TOO_SMALL;
   5.313      else
   5.314      {
   5.315        status = WdfRequestRetrieveOutputBuffer(request, output_buffer_length, (PVOID *)&uhdn, &length);
   5.316 @@ -855,7 +966,7 @@ XenUsb_EvtIoDeviceControl(
   5.317            symbolic_link.Buffer += 4;
   5.318            symbolic_link.Length -= 4 * sizeof(WCHAR);
   5.319            uhdn->ActualLength = FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + symbolic_link.Length + sizeof(WCHAR);
   5.320 -          if (output_buffer_length >= uhdn->ActualLength)
   5.321 +          if (output_buffer_length >= FIELD_OFFSET(USB_HCD_DRIVERKEY_NAME, DriverKeyName) + symbolic_link.Length + sizeof(WCHAR))
   5.322            {
   5.323              memcpy(uhdn->DriverKeyName, symbolic_link.Buffer, symbolic_link.Length);
   5.324              uhdn->DriverKeyName[symbolic_link.Length / 2] = 0;
   5.325 @@ -886,7 +997,7 @@ XenUsb_EvtIoDeviceControl(
   5.326      KdPrint((__DRIVER_NAME "      output_buffer_length = %d\n", output_buffer_length));
   5.327        
   5.328      if (output_buffer_length < sizeof(USB_HCD_DRIVERKEY_NAME))
   5.329 -      status = STATUS_INSUFFICIENT_RESOURCES;
   5.330 +      status = STATUS_BUFFER_TOO_SMALL;
   5.331      else
   5.332      {
   5.333        status = WdfRequestRetrieveOutputBuffer(request, output_buffer_length, (PVOID *)&uhdn, &length);
   5.334 @@ -940,30 +1051,36 @@ XenUsb_EvtIoInternalDeviceControl(
   5.335    size_t input_buffer_length,
   5.336    ULONG io_control_code)
   5.337  {
   5.338 -  WDFDEVICE device = WdfIoQueueGetDevice(queue);
   5.339 -  PXENUSB_DEVICE_DATA xudd = GetXudd(device);
   5.340 +  //WDFDEVICE device = WdfIoQueueGetDevice(queue);
   5.341 +  //PXENUSB_DEVICE_DATA xudd = GetXudd(device);
   5.342 +  PURB urb;
   5.343 +  xenusb_device_t *usb_device;
   5.344 +  WDF_REQUEST_PARAMETERS wrp;
   5.345  
   5.346 +  UNREFERENCED_PARAMETER(queue);
   5.347    UNREFERENCED_PARAMETER(input_buffer_length);
   5.348    UNREFERENCED_PARAMETER(output_buffer_length);
   5.349  
   5.350 -  FUNCTION_ENTER();
   5.351 +  //FUNCTION_ENTER();
   5.352 +
   5.353 +  WDF_REQUEST_PARAMETERS_INIT(&wrp);
   5.354 +  WdfRequestGetParameters(request, &wrp);
   5.355  
   5.356    switch(io_control_code)
   5.357    {
   5.358 -  case IOCTL_XEN_RECONFIGURE:
   5.359 -    KdPrint((__DRIVER_NAME "     IOCTL_XEN_RECONFIGURE\n"));
   5.360 -    // TODO: Only enumerate once the root hub callback has been called...
   5.361 -    XenUsb_EnumeratePorts(xudd->root_hub_device);
   5.362 -    KdPrint((__DRIVER_NAME "     Completing\n"));
   5.363 -    WdfRequestComplete(request, STATUS_SUCCESS);
   5.364 +  case IOCTL_INTERNAL_USB_SUBMIT_URB:
   5.365 +    urb = (PURB)wrp.Parameters.Others.Arg1;
   5.366 +    ASSERT(urb);
   5.367 +    usb_device = urb->UrbHeader.UsbdDeviceHandle;
   5.368 +    ASSERT(usb_device);
   5.369 +    WdfRequestForwardToIoQueue(request, usb_device->urb_queue);
   5.370      break;
   5.371    default:
   5.372      KdPrint((__DRIVER_NAME "     Unknown IOCTL %08x\n", io_control_code));
   5.373      WdfRequestComplete(request, WdfRequestGetStatus(request));
   5.374      break;
   5.375    }
   5.376 -
   5.377 -  FUNCTION_EXIT();
   5.378 +  //FUNCTION_EXIT();
   5.379  }
   5.380  
   5.381  static VOID
   5.382 @@ -999,7 +1116,6 @@ XenUsb_EvtIoDefault(
   5.383      break;
   5.384    case WdfRequestTypeDeviceControl:
   5.385      KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControl\n"));
   5.386 -    
   5.387      break;
   5.388    case WdfRequestTypeDeviceControlInternal:
   5.389      KdPrint((__DRIVER_NAME "     WdfRequestTypeDeviceControlInternal\n"));
   5.390 @@ -1074,7 +1190,7 @@ XenUsb_EvtDriverDeviceAdd(WDFDRIVER driv
   5.391    xudd = GetXudd(device);
   5.392    xudd->child_list = WdfFdoGetDefaultChildList(device);
   5.393  
   5.394 -  KeInitializeSpinLock(&xudd->ring_lock);
   5.395 +  KeInitializeSpinLock(&xudd->urb_ring_lock);
   5.396    
   5.397    WdfDeviceSetAlignmentRequirement(device, 0);
   5.398    WDF_DMA_ENABLER_CONFIG_INIT(&dma_config, WdfDmaProfileScatterGather64Duplex, PAGE_SIZE);
     6.1 --- a/xenusb/xenusb_hub.c	Wed Sep 23 17:06:05 2009 +1000
     6.2 +++ b/xenusb/xenusb_hub.c	Wed Sep 23 17:06:30 2009 +1000
     6.3 @@ -221,11 +221,16 @@ XenUsbHub_EvtIoInternalDeviceControl(
     6.4    case IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO:
     6.5      KdPrint((__DRIVER_NAME "     IOCTL_INTERNAL_USB_GET_ROOTHUB_PDO\n"));
     6.6      KdPrint((__DRIVER_NAME "     WdfDeviceWdmGetPhysicalDevice(device) = %p\n", WdfDeviceWdmGetPhysicalDevice(device)));
     6.7 -    KdPrint((__DRIVER_NAME "     WdfDeviceWdmGetDeviceObject(device) = %p\n", WdfDeviceWdmGetDeviceObject(device)));
     6.8 -    KdPrint((__DRIVER_NAME "     WdfDeviceWdmGetAttachedDevice(device) = %p\n", WdfDeviceWdmGetAttachedDevice(device)));
     6.9 -    KdPrint((__DRIVER_NAME "     IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device)) = %p\n", IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device))));
    6.10 +    //KdPrint((__DRIVER_NAME "     IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device)) = %p\n", IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device))));
    6.11      *(PVOID *)wrp.Parameters.Others.Arg1 = WdfDeviceWdmGetPhysicalDevice(device);
    6.12 -    *(PVOID *)wrp.Parameters.Others.Arg2 = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device));
    6.13 +    //*(PVOID *)wrp.Parameters.Others.Arg2 = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device));
    6.14 +    *(PVOID *)wrp.Parameters.Others.Arg2 = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(xupdd->wdf_device_bus_fdo));
    6.15 +    {
    6.16 +    //PDEVICE_OBJECT hcdTopOfStack = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(device));
    6.17 +    PDEVICE_OBJECT hcdTopOfStack = IoGetAttachedDevice(WdfDeviceWdmGetDeviceObject(xupdd->wdf_device_bus_fdo));
    6.18 +    KdPrint((__DRIVER_NAME "     hcdTopOfStack = %p\n", hcdTopOfStack));
    6.19 +    KdPrint((__DRIVER_NAME "     hcdTopOfStack->StackSize = %p\n", hcdTopOfStack->StackSize));
    6.20 +    }
    6.21      status = STATUS_SUCCESS;
    6.22      break;
    6.23    case IOCTL_INTERNAL_USB_RESET_PORT:
    6.24 @@ -416,7 +421,7 @@ XenUsb_SubmitCompletionRoutine(
    6.25  }
    6.26  
    6.27  static NTSTATUS
    6.28 -XenPciPdo_UBIH_CreateUsbDevice(
    6.29 +XenUsbHub_UBIH_CreateUsbDevice(
    6.30    PVOID BusContext,
    6.31    PUSB_DEVICE_HANDLE *DeviceHandle,
    6.32    PUSB_DEVICE_HANDLE *HubDeviceHandle,
    6.33 @@ -449,7 +454,7 @@ XenUsb_SetEventCallback(usbif_shadow_t *
    6.34  }
    6.35  
    6.36  static NTSTATUS
    6.37 -XenPciPdo_UBIH_InitializeUsbDevice(
    6.38 +XenUsbHub_UBIH_InitializeUsbDevice(
    6.39   PVOID BusContext,
    6.40   PUSB_DEVICE_HANDLE DeviceHandle)
    6.41  {
    6.42 @@ -653,7 +658,7 @@ XenPciPdo_UBIH_InitializeUsbDevice(
    6.43    WDF_IO_QUEUE_CONFIG_INIT(&queue_config, WdfIoQueueDispatchParallel);
    6.44    queue_config.EvtIoInternalDeviceControl = XenUsb_EvtIoInternalDeviceControl_DEVICE_SUBMIT_URB;
    6.45    queue_config.PowerManaged = TRUE; /* power managed queue for SUBMIT_URB */
    6.46 -  status = WdfIoQueueCreate(device, &queue_config, WDF_NO_OBJECT_ATTRIBUTES, &usb_device->urb_queue);
    6.47 +  status = WdfIoQueueCreate(xupdd->wdf_device_bus_fdo, &queue_config, WDF_NO_OBJECT_ATTRIBUTES, &usb_device->urb_queue);
    6.48    if (!NT_SUCCESS(status)) {
    6.49        KdPrint((__DRIVER_NAME "     Error creating urb_queue 0x%x\n", status));
    6.50        return status;
    6.51 @@ -666,7 +671,7 @@ XenPciPdo_UBIH_InitializeUsbDevice(
    6.52  }
    6.53  
    6.54  static NTSTATUS
    6.55 -XenPciPdo_UBIH_GetUsbDescriptors(
    6.56 +XenUsbHub_UBIH_GetUsbDescriptors(
    6.57    PVOID BusContext,
    6.58    PUSB_DEVICE_HANDLE DeviceHandle,
    6.59    PUCHAR DeviceDescriptorBuffer,
    6.60 @@ -719,7 +724,7 @@ XenPciPdo_UBIH_GetUsbDescriptors(
    6.61  }
    6.62  
    6.63  static NTSTATUS
    6.64 -XenPciPdo_UBIH_RemoveUsbDevice (
    6.65 +XenUsbHub_UBIH_RemoveUsbDevice (
    6.66   PVOID BusContext,
    6.67   PUSB_DEVICE_HANDLE DeviceHandle,
    6.68   ULONG Flags)
    6.69 @@ -742,7 +747,7 @@ XenPciPdo_UBIH_RemoveUsbDevice (
    6.70  }
    6.71  
    6.72  static NTSTATUS
    6.73 -XenPciPdo_UBIH_RestoreUsbDevice(
    6.74 +XenUsbHub_UBIH_RestoreUsbDevice(
    6.75    PVOID BusContext,
    6.76    PUSB_DEVICE_HANDLE OldDeviceHandle,
    6.77    PUSB_DEVICE_HANDLE NewDeviceHandle)
    6.78 @@ -760,7 +765,7 @@ XenPciPdo_UBIH_RestoreUsbDevice(
    6.79  }
    6.80  
    6.81  static NTSTATUS
    6.82 -XenPciPdo_UBIH_GetPortHackFlags(
    6.83 +XenUsbHub_UBIH_GetPortHackFlags(
    6.84   PVOID BusContext,
    6.85   PULONG HackFlags)
    6.86  {
    6.87 @@ -776,7 +781,7 @@ XenPciPdo_UBIH_GetPortHackFlags(
    6.88  }
    6.89  
    6.90  static NTSTATUS
    6.91 -XenPciPdo_UBIH_QueryDeviceInformation(
    6.92 +XenUsbHub_UBIH_QueryDeviceInformation(
    6.93    PVOID BusContext,
    6.94    PUSB_DEVICE_HANDLE DeviceHandle,
    6.95    PVOID DeviceInformationBuffer,
    6.96 @@ -786,6 +791,7 @@ XenPciPdo_UBIH_QueryDeviceInformation(
    6.97    PUSB_DEVICE_INFORMATION_0 udi = DeviceInformationBuffer;
    6.98    xenusb_device_t *usb_device = DeviceHandle;
    6.99    ULONG i;
   6.100 +  ULONG required_size;
   6.101  
   6.102    FUNCTION_ENTER();
   6.103  
   6.104 @@ -794,7 +800,10 @@ XenPciPdo_UBIH_QueryDeviceInformation(
   6.105    KdPrint((__DRIVER_NAME "     DeviceInformationBuffer = %p\n", DeviceInformationBuffer));
   6.106    KdPrint((__DRIVER_NAME "     DeviceInformationBufferLength = %d\n", DeviceInformationBufferLength));
   6.107    KdPrint((__DRIVER_NAME "     ->InformationLevel = %d\n", udi->InformationLevel));
   6.108 -  if (DeviceInformationBufferLength < (ULONG)FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[usb_device->active_interface->interface_descriptor.bNumEndpoints]))
   6.109 +  required_size = (ULONG)FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[usb_device->active_interface->interface_descriptor.bNumEndpoints]);
   6.110 +  KdPrint((__DRIVER_NAME "     required_size = %d\n", required_size));
   6.111 +  *LengthOfDataReturned = required_size;
   6.112 +  if (DeviceInformationBufferLength < required_size)
   6.113    {
   6.114      KdPrint((__DRIVER_NAME "     STATUS_BUFFER_TOO_SMALL\n"));
   6.115      FUNCTION_EXIT();
   6.116 @@ -806,7 +815,7 @@ XenPciPdo_UBIH_QueryDeviceInformation(
   6.117      FUNCTION_EXIT();
   6.118      return STATUS_NOT_SUPPORTED;
   6.119    }
   6.120 -  udi->ActualLength = FIELD_OFFSET(USB_DEVICE_INFORMATION_0, PipeList[usb_device->active_interface->interface_descriptor.bNumEndpoints]);
   6.121 +  udi->ActualLength = required_size;
   6.122    udi->PortNumber = 1;
   6.123    memcpy(&udi->DeviceDescriptor, &usb_device->device_descriptor, sizeof(USB_DEVICE_DESCRIPTOR));
   6.124    udi->CurrentConfigurationValue = usb_device->active_config->config_descriptor.bConfigurationValue;
   6.125 @@ -820,13 +829,12 @@ XenPciPdo_UBIH_QueryDeviceInformation(
   6.126      memcpy(&udi->PipeList[i].EndpointDescriptor, &usb_device->active_interface->endpoints[i]->endpoint_descriptor, sizeof(USB_ENDPOINT_DESCRIPTOR));
   6.127      udi->PipeList[0].ScheduleOffset = 0; // not necessarily right
   6.128    }
   6.129 -  *LengthOfDataReturned = udi->ActualLength;
   6.130    FUNCTION_EXIT();
   6.131    return STATUS_SUCCESS;
   6.132  }
   6.133  
   6.134  static NTSTATUS
   6.135 -XenPciPdo_UBIH_GetControllerInformation (
   6.136 +XenUsbHub_UBIH_GetControllerInformation (
   6.137    PVOID BusContext,
   6.138    PVOID ControllerInformationBuffer,
   6.139    ULONG ControllerInformationBufferLength,
   6.140 @@ -866,7 +874,7 @@ XenPciPdo_UBIH_GetControllerInformation 
   6.141  }
   6.142  
   6.143  static NTSTATUS
   6.144 -XenPciPdo_UBIH_ControllerSelectiveSuspend (
   6.145 +XenUsbHub_UBIH_ControllerSelectiveSuspend (
   6.146    PVOID BusContext,
   6.147    BOOLEAN Enable)
   6.148  {
   6.149 @@ -882,7 +890,7 @@ XenPciPdo_UBIH_ControllerSelectiveSuspen
   6.150  }
   6.151  
   6.152  static NTSTATUS
   6.153 -XenPciPdo_UBIH_GetExtendedHubInformation (
   6.154 +XenUsbHub_UBIH_GetExtendedHubInformation (
   6.155    PVOID BusContext,
   6.156    PDEVICE_OBJECT HubPhysicalDeviceObject,
   6.157    PVOID HubInformationBuffer,
   6.158 @@ -927,7 +935,7 @@ XenPciPdo_UBIH_GetExtendedHubInformation
   6.159  }
   6.160  
   6.161  static NTSTATUS
   6.162 -XenPciPdo_UBIH_GetRootHubSymbolicName(
   6.163 +XenUsbHub_UBIH_GetRootHubSymbolicName(
   6.164    PVOID BusContext,
   6.165    PVOID HubInformationBuffer,
   6.166    ULONG HubInformationBufferLength,
   6.167 @@ -948,7 +956,7 @@ XenPciPdo_UBIH_GetRootHubSymbolicName(
   6.168  }
   6.169  
   6.170  static PVOID
   6.171 -XenPciPdo_UBIH_GetDeviceBusContext(
   6.172 +XenUsbHub_UBIH_GetDeviceBusContext(
   6.173    PVOID BusContext,
   6.174    PVOID DeviceHandle)
   6.175  {
   6.176 @@ -962,7 +970,7 @@ XenPciPdo_UBIH_GetDeviceBusContext(
   6.177  }
   6.178  
   6.179  static NTSTATUS
   6.180 -XenPciPdo_UBIH_Initialize20Hub (
   6.181 +XenUsbHub_UBIH_Initialize20Hub (
   6.182    PVOID BusContext,
   6.183    PUSB_DEVICE_HANDLE HubDeviceHandle,
   6.184    ULONG TtCount)
   6.185 @@ -977,7 +985,7 @@ XenPciPdo_UBIH_Initialize20Hub (
   6.186  }
   6.187  
   6.188  static NTSTATUS
   6.189 -XenPciPdo_UBIH_RootHubInitNotification(
   6.190 +XenUsbHub_UBIH_RootHubInitNotification(
   6.191    PVOID BusContext,
   6.192    PVOID CallbackContext,
   6.193    PRH_INIT_CALLBACK CallbackFunction)
   6.194 @@ -998,7 +1006,7 @@ XenPciPdo_UBIH_RootHubInitNotification(
   6.195  }
   6.196  
   6.197  static NTSTATUS
   6.198 -XenPciPdo_UBIH_FlushTransfers(
   6.199 +XenUsbHub_UBIH_FlushTransfers(
   6.200    PVOID BusContext,
   6.201    PUSB_DEVICE_HANDLE DeviceHandle)
   6.202  {
   6.203 @@ -1014,7 +1022,7 @@ XenPciPdo_UBIH_FlushTransfers(
   6.204  }
   6.205  
   6.206  static VOID
   6.207 -XenPciPdo_UBIH_SetDeviceHandleData(
   6.208 +XenUsbHub_UBIH_SetDeviceHandleData(
   6.209    PVOID BusContext,
   6.210    PUSB_DEVICE_HANDLE DeviceHandle,
   6.211    PDEVICE_OBJECT UsbDevicePdo)
   6.212 @@ -1028,7 +1036,7 @@ XenPciPdo_UBIH_SetDeviceHandleData(
   6.213  }
   6.214  
   6.215  static NTSTATUS
   6.216 -XenPciPdo_UBIU_GetUSBDIVersion(
   6.217 +XenUsbHub_UBIU_GetUSBDIVersion(
   6.218    PVOID BusContext,
   6.219    PUSBD_VERSION_INFORMATION VersionInformation,
   6.220    PULONG HcdCapabilities
   6.221 @@ -1047,7 +1055,7 @@ XenPciPdo_UBIU_GetUSBDIVersion(
   6.222  }
   6.223  
   6.224  static NTSTATUS
   6.225 -XenPciPdo_UBIU_QueryBusTime(
   6.226 +XenUsbHub_UBIU_QueryBusTime(
   6.227    PVOID BusContext,
   6.228    PULONG CurrentFrame
   6.229    )
   6.230 @@ -1064,7 +1072,7 @@ XenPciPdo_UBIU_QueryBusTime(
   6.231  }
   6.232  
   6.233  static NTSTATUS
   6.234 -XenPciPdo_UBIU_SubmitIsoOutUrb(
   6.235 +XenUsbHub_UBIU_SubmitIsoOutUrb(
   6.236    PVOID BusContext,
   6.237    PURB Urb
   6.238    )
   6.239 @@ -1081,7 +1089,7 @@ XenPciPdo_UBIU_SubmitIsoOutUrb(
   6.240  }
   6.241  
   6.242  static NTSTATUS
   6.243 -XenPciPdo_UBIU_QueryBusInformation(
   6.244 +XenUsbHub_UBIU_QueryBusInformation(
   6.245    PVOID BusContext,
   6.246    ULONG Level,
   6.247    PVOID BusInformationBuffer,
   6.248 @@ -1103,7 +1111,7 @@ XenPciPdo_UBIU_QueryBusInformation(
   6.249  }
   6.250  
   6.251  static BOOLEAN
   6.252 -XenPciPdo_UBIU_IsDeviceHighSpeed(PVOID BusContext)
   6.253 +XenUsbHub_UBIU_IsDeviceHighSpeed(PVOID BusContext)
   6.254  {
   6.255    UNREFERENCED_PARAMETER(BusContext);
   6.256    
   6.257 @@ -1114,7 +1122,7 @@ XenPciPdo_UBIU_IsDeviceHighSpeed(PVOID B
   6.258  }
   6.259  
   6.260  static NTSTATUS
   6.261 -XenPciPdo_UBIU_EnumLogEntry(
   6.262 +XenUsbHub_UBIU_EnumLogEntry(
   6.263    PVOID BusContext,
   6.264    ULONG DriverTag,
   6.265    ULONG EnumTag,
   6.266 @@ -1136,6 +1144,7 @@ XenPciPdo_UBIU_EnumLogEntry(
   6.267    return status;
   6.268  }
   6.269  
   6.270 +#if 0
   6.271  VOID
   6.272  XenUsb_EnumeratePorts(WDFDEVICE device)
   6.273  {
   6.274 @@ -1184,6 +1193,7 @@ XenUsb_EnumeratePorts(WDFDEVICE device)
   6.275      }
   6.276    }  
   6.277  }
   6.278 +#endif
   6.279  
   6.280  static VOID
   6.281  XenUsbHub_HubInterruptTimer(WDFTIMER timer)
   6.282 @@ -1286,6 +1296,7 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   6.283  
   6.284    WdfDeviceInitSetDeviceType(child_init, FILE_DEVICE_UNKNOWN);
   6.285    
   6.286 +  WDF_PNPPOWER_EVENT_CALLBACKS_INIT(&child_pnp_power_callbacks);
   6.287    child_pnp_power_callbacks.EvtDeviceD0Entry = XenUsbHub_EvtDeviceD0Entry;
   6.288    child_pnp_power_callbacks.EvtDeviceD0Exit = XenUsbHub_EvtDeviceD0Exit;
   6.289    child_pnp_power_callbacks.EvtDevicePrepareHardware = XenUsbHub_EvtDevicePrepareHardware;
   6.290 @@ -1453,22 +1464,22 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   6.291    ubih.BusContext = child_device;
   6.292    ubih.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   6.293    ubih.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   6.294 -  ubih.CreateUsbDevice = XenPciPdo_UBIH_CreateUsbDevice;
   6.295 -  ubih.InitializeUsbDevice = XenPciPdo_UBIH_InitializeUsbDevice;
   6.296 -  ubih.GetUsbDescriptors = XenPciPdo_UBIH_GetUsbDescriptors;
   6.297 -  ubih.RemoveUsbDevice = XenPciPdo_UBIH_RemoveUsbDevice;
   6.298 -  ubih.RestoreUsbDevice = XenPciPdo_UBIH_RestoreUsbDevice;
   6.299 -  ubih.GetPortHackFlags = XenPciPdo_UBIH_GetPortHackFlags;
   6.300 -  ubih.QueryDeviceInformation = XenPciPdo_UBIH_QueryDeviceInformation;
   6.301 -  ubih.GetControllerInformation = XenPciPdo_UBIH_GetControllerInformation;
   6.302 -  ubih.ControllerSelectiveSuspend = XenPciPdo_UBIH_ControllerSelectiveSuspend;
   6.303 -  ubih.GetExtendedHubInformation = XenPciPdo_UBIH_GetExtendedHubInformation;
   6.304 -  ubih.GetRootHubSymbolicName = XenPciPdo_UBIH_GetRootHubSymbolicName;
   6.305 -  ubih.GetDeviceBusContext = XenPciPdo_UBIH_GetDeviceBusContext;
   6.306 -  ubih.Initialize20Hub = XenPciPdo_UBIH_Initialize20Hub;
   6.307 -  ubih.RootHubInitNotification = XenPciPdo_UBIH_RootHubInitNotification;
   6.308 -  ubih.FlushTransfers = XenPciPdo_UBIH_FlushTransfers;
   6.309 -  ubih.SetDeviceHandleData = XenPciPdo_UBIH_SetDeviceHandleData;
   6.310 +  ubih.CreateUsbDevice = XenUsbHub_UBIH_CreateUsbDevice;
   6.311 +  ubih.InitializeUsbDevice = XenUsbHub_UBIH_InitializeUsbDevice;
   6.312 +  ubih.GetUsbDescriptors = XenUsbHub_UBIH_GetUsbDescriptors;
   6.313 +  ubih.RemoveUsbDevice = XenUsbHub_UBIH_RemoveUsbDevice;
   6.314 +  ubih.RestoreUsbDevice = XenUsbHub_UBIH_RestoreUsbDevice;
   6.315 +  ubih.GetPortHackFlags = XenUsbHub_UBIH_GetPortHackFlags;
   6.316 +  ubih.QueryDeviceInformation = XenUsbHub_UBIH_QueryDeviceInformation;
   6.317 +  ubih.GetControllerInformation = XenUsbHub_UBIH_GetControllerInformation;
   6.318 +  ubih.ControllerSelectiveSuspend = XenUsbHub_UBIH_ControllerSelectiveSuspend;
   6.319 +  ubih.GetExtendedHubInformation = XenUsbHub_UBIH_GetExtendedHubInformation;
   6.320 +  ubih.GetRootHubSymbolicName = XenUsbHub_UBIH_GetRootHubSymbolicName;
   6.321 +  ubih.GetDeviceBusContext = XenUsbHub_UBIH_GetDeviceBusContext;
   6.322 +  ubih.Initialize20Hub = XenUsbHub_UBIH_Initialize20Hub;
   6.323 +  ubih.RootHubInitNotification = XenUsbHub_UBIH_RootHubInitNotification;
   6.324 +  ubih.FlushTransfers = XenUsbHub_UBIH_FlushTransfers;
   6.325 +  ubih.SetDeviceHandleData = XenUsbHub_UBIH_SetDeviceHandleData;
   6.326    ubih.Size = sizeof(USB_BUS_INTERFACE_HUB_V5);
   6.327    ubih.Version = USB_BUSIF_HUB_VERSION_5;
   6.328    WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubih, &USB_BUS_INTERFACE_HUB_GUID, NULL);
   6.329 @@ -1479,12 +1490,12 @@ XenUsb_EvtChildListCreateDevice(WDFCHILD
   6.330    ubiu.BusContext = child_device;
   6.331    ubiu.InterfaceReference = WdfDeviceInterfaceReferenceNoOp;
   6.332    ubiu.InterfaceDereference = WdfDeviceInterfaceDereferenceNoOp;
   6.333 -  ubiu.GetUSBDIVersion = XenPciPdo_UBIU_GetUSBDIVersion;
   6.334 -  ubiu.QueryBusTime = XenPciPdo_UBIU_QueryBusTime;
   6.335 -  ubiu.SubmitIsoOutUrb = XenPciPdo_UBIU_SubmitIsoOutUrb;
   6.336 -  ubiu.QueryBusInformation = XenPciPdo_UBIU_QueryBusInformation;
   6.337 -  ubiu.IsDeviceHighSpeed = XenPciPdo_UBIU_IsDeviceHighSpeed;
   6.338 -  ubiu.EnumLogEntry  = XenPciPdo_UBIU_EnumLogEntry;
   6.339 +  ubiu.GetUSBDIVersion = XenUsbHub_UBIU_GetUSBDIVersion;
   6.340 +  ubiu.QueryBusTime = XenUsbHub_UBIU_QueryBusTime;
   6.341 +  ubiu.SubmitIsoOutUrb = XenUsbHub_UBIU_SubmitIsoOutUrb;
   6.342 +  ubiu.QueryBusInformation = XenUsbHub_UBIU_QueryBusInformation;
   6.343 +  ubiu.IsDeviceHighSpeed = XenUsbHub_UBIU_IsDeviceHighSpeed;
   6.344 +  ubiu.EnumLogEntry  = XenUsbHub_UBIU_EnumLogEntry;
   6.345    ubiu.Size = sizeof(USB_BUS_INTERFACE_USBDI_V2);
   6.346    ubiu.Version = USB_BUSIF_HUB_VERSION_2;
   6.347    WDF_QUERY_INTERFACE_CONFIG_INIT(&interface_config, (PINTERFACE)&ubiu, &USB_BUS_INTERFACE_USBDI_GUID, NULL);
     7.1 --- a/xenusb/xenusb_huburb.c	Wed Sep 23 17:06:05 2009 +1000
     7.2 +++ b/xenusb/xenusb_huburb.c	Wed Sep 23 17:06:30 2009 +1000
     7.3 @@ -164,15 +164,6 @@ XenUsb_EvtIoInternalDeviceControl_ROOTHU
     7.4      KdPrint((__DRIVER_NAME "      TransferBuffer = %p\n", urb->UrbControlDescriptorRequest.TransferBuffer));
     7.5      KdPrint((__DRIVER_NAME "      TransferBufferMDL = %p\n", urb->UrbControlDescriptorRequest.TransferBufferMDL));
     7.6      KdPrint((__DRIVER_NAME "      UrbLink = %p\n", urb->UrbControlDescriptorRequest.UrbLink));
     7.7 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[0] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[0]));
     7.8 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[1] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[1]));
     7.9 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[2] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[2]));
    7.10 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[3] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[3]));
    7.11 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[4] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[4]));
    7.12 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[5] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[5]));
    7.13 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[6] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[6]));
    7.14 -    KdPrint((__DRIVER_NAME "      hca.Reserved8[7] = %p\n", urb->UrbControlDescriptorRequest.hca.Reserved8[7]));
    7.15 -    KdPrint((__DRIVER_NAME "      Reserved1 = %04x\n", urb->UrbControlDescriptorRequest.Reserved1));
    7.16      KdPrint((__DRIVER_NAME "      Index = %d\n", (int)urb->UrbControlDescriptorRequest.Index));
    7.17      KdPrint((__DRIVER_NAME "      DescriptorType = %d\n", (int)urb->UrbControlDescriptorRequest.DescriptorType));
    7.18      KdPrint((__DRIVER_NAME "      LanguageId = %04x\n", urb->UrbControlDescriptorRequest.LanguageId));
    7.19 @@ -432,7 +423,6 @@ XenUsb_EvtIoInternalDeviceControl_ROOTHU
    7.20  #endif
    7.21      endpoint = urb->UrbBulkOrInterruptTransfer.PipeHandle;
    7.22      WdfSpinLockAcquire (endpoint->interrupt_lock);
    7.23 -    // we should synchronise to the timer here to prevent a race
    7.24      if (WdfIoQueueGetState(endpoint->interrupt_queue, NULL, NULL) & WdfIoQueueNoRequests)
    7.25      {
    7.26        status = WdfTimerStart(endpoint->interrupt_timer, WDF_REL_TIMEOUT_IN_MS(100));