win-pvdrivers

changeset 1014:fe3af8f4d54b

Fix incompatibilities between scsiport and storport drivers. Fix warnings for 2000.
author James Harper <james.harper@bendigoit.com.au>
date Mon Feb 11 21:04:34 2013 +1100 (2013-02-11)
parents 43e76afb2398
children a9acb0825429
files xenvbd_common/common_miniport.h xenvbd_filter/sources xenvbd_filter/xenvbd_filter.h xenvbd_scsiport/xenvbd.c xenvbd_scsiport/xenvbd.h xenvbd_storport/xenvbd.c
line diff
     1.1 --- a/xenvbd_common/common_miniport.h	Mon Feb 11 20:59:11 2013 +1100
     1.2 +++ b/xenvbd_common/common_miniport.h	Mon Feb 11 21:04:34 2013 +1100
     1.3 @@ -234,12 +234,16 @@ XenVbd_HandleEvent(PXENVBD_DEVICE_DATA x
     1.4              xvdd->last_additional_sense_code = SCSI_ADSENSE_NO_SENSE;
     1.5              XenVbd_MakeAutoSense(xvdd, srb);
     1.6            }
     1.7 -          //FUNCTION_MSG("Completing Srb = %p\n", srb);
     1.8            SxxxPortNotification(RequestComplete, xvdd, srb);
     1.9          }
    1.10        }
    1.11        put_shadow_on_freelist(xvdd, shadow);
    1.12      }
    1.13 +    
    1.14 +    /* put queue'd Srbs onto the ring now so we can set the event in the best possible way */
    1.15 +    if (dump_mode || xvdd->device_state == DEVICE_STATE_ACTIVE) {
    1.16 +      XenVbd_ProcessSrbList(xvdd);
    1.17 +    }
    1.18  
    1.19      xvdd->ring.rsp_cons = i;
    1.20      if (i == xvdd->ring.req_prod_pvt) {
    1.21 @@ -291,16 +295,13 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    1.22    NT_ASSERT(srb);
    1.23  
    1.24    if (!dump_mode) {
    1.25 -#if 0
    1.26 -    if (StorPortGetSystemAddress(xvdd, srb, &system_address) != STOR_STATUS_SUCCESS) {
    1.27 +    if (SxxxPortGetSystemAddress(xvdd, srb, &system_address) != STATUS_SUCCESS) {
    1.28        FUNCTION_MSG("Failed to map DataBuffer\n");
    1.29        InsertHeadList(&xvdd->srb_list, (PLIST_ENTRY)srb->SrbExtension);
    1.30        //if (dump_mode) FUNCTION_EXIT();
    1.31        return FALSE;
    1.32      }
    1.33      system_address = (PUCHAR)system_address + srb_entry->offset;
    1.34 -#endif
    1.35 -    system_address = (PUCHAR)srb->DataBuffer + srb_entry->offset;
    1.36    } else {
    1.37      //FUNCTION_MSG("DataBuffer = %p\n", srb->DataBuffer);
    1.38      system_address = (PUCHAR)srb->DataBuffer + srb_entry->offset;
    1.39 @@ -388,15 +389,6 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    1.40      ptr = shadow->system_address;
    1.41      shadow->aligned_buffer_in_use = FALSE;
    1.42    }
    1.43 -
    1.44 -  //KdPrint((__DRIVER_NAME "     sector_number = %d, block_count = %d\n", (ULONG)sector_number, block_count));
    1.45 -  //KdPrint((__DRIVER_NAME "     DataBuffer   = %p\n", srb->DataBuffer));
    1.46 -  //KdPrint((__DRIVER_NAME "     system_address   = %p\n", shadow->system_address));
    1.47 -  //KdPrint((__DRIVER_NAME "     offset   = %d, length = %d\n", srb_entry->offset, srb_entry->length));
    1.48 -  //KdPrint((__DRIVER_NAME "     ptr   = %p\n", ptr));
    1.49 -
    1.50 -  //KdPrint((__DRIVER_NAME "     handle = %d\n", shadow->req.handle));
    1.51 -  //KdPrint((__DRIVER_NAME "     operation = %d\n", shadow->req.operation));
    1.52    
    1.53    remaining = block_count * 512;
    1.54    while (remaining > 0 && shadow->req.nr_segments < BLKIF_MAX_SEGMENTS_PER_REQUEST) {
    1.55 @@ -445,18 +437,16 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    1.56    }
    1.57    srb_entry->offset += shadow->length;
    1.58    srb_entry->outstanding_requests++;
    1.59 +  XenVbd_PutRequest(xvdd, &shadow->req);
    1.60    if (srb_entry->offset < srb_entry->length) {
    1.61 -    if (dump_mode) KdPrint((__DRIVER_NAME "     inserting back into list\n"));
    1.62      /* put the srb back at the start of the queue to continue on the next request */
    1.63      InsertHeadList(&xvdd->srb_list, (PLIST_ENTRY)srb_entry);
    1.64    }
    1.65 -  XenVbd_PutRequest(xvdd, &shadow->req);
    1.66    //if (dump_mode)
    1.67    //FUNCTION_EXIT();
    1.68    return TRUE;
    1.69  }
    1.70  
    1.71 -
    1.72  static ULONG
    1.73  XenVbd_FillModePage(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb) {
    1.74    PMODE_PARAMETER_HEADER parameter_header = NULL;
    1.75 @@ -639,7 +629,7 @@ XenVbd_ResetBus(PXENVBD_DEVICE_DATA xvdd
    1.76    while((list_entry = RemoveHeadList(&xvdd->srb_list)) != &xvdd->srb_list) {
    1.77      #if DBG
    1.78      srb_list_entry_t *srb_entry = CONTAINING_RECORD(list_entry, srb_list_entry_t, list_entry);
    1.79 -    KdPrint((__DRIVER_NAME "     adding queued SRB %p to reset list\n", srb_entry->srb));
    1.80 +    FUNCTION_MSG("adding queued SRB %p to reset list\n", srb_entry->srb);
    1.81      #endif
    1.82      InsertTailList(&srb_reset_list, list_entry);
    1.83    }
    1.84 @@ -692,7 +682,7 @@ XenVbd_ProcessSrbList(PXENVBD_DEVICE_DAT
    1.85    PCDB cdb;
    1.86    ULONG data_transfer_length;
    1.87    UCHAR srb_status = SRB_STATUS_PENDING;
    1.88 -  BOOLEAN notify = FALSE;
    1.89 +  ULONG notify = FALSE;
    1.90    PSCSI_REQUEST_BLOCK srb;
    1.91    srb_list_entry_t *srb_entry;
    1.92    PSRB_IO_CONTROL sic;
    1.93 @@ -1252,7 +1242,7 @@ XenVbd_ProcessSrbList(PXENVBD_DEVICE_DAT
    1.94      }
    1.95      if ((PLIST_ENTRY)srb_entry == xvdd->srb_list.Flink && srb_entry->offset == prev_offset) {
    1.96        FUNCTION_MSG("Same entry\n");
    1.97 -      /* same entry was put back onto the head of the list so we can't progress */
    1.98 +      /* same entry was put back onto the head of the list unchanged so we can't progress */
    1.99        break;
   1.100      }
   1.101    }
     2.1 --- a/xenvbd_filter/sources	Mon Feb 11 20:59:11 2013 +1100
     2.2 +++ b/xenvbd_filter/sources	Mon Feb 11 21:04:34 2013 +1100
     2.3 @@ -1,6 +1,5 @@
     2.4  !INCLUDE "..\common.inc"
     2.5  TARGETNAME=xenvbdfilter
     2.6 -INF_NAME=xenvbd_filter
     2.7  TARGETTYPE=DRIVER
     2.8  KMDF_VERSION_MAJOR=1
     2.9  !IF $(386)
     3.1 --- a/xenvbd_filter/xenvbd_filter.h	Mon Feb 11 20:59:11 2013 +1100
     3.2 +++ b/xenvbd_filter/xenvbd_filter.h	Mon Feb 11 21:04:34 2013 +1100
     3.3 @@ -24,6 +24,10 @@ Foundation, Inc., 51 Franklin Street, Fi
     3.4  
     3.5  #include <ntddk.h>
     3.6  #include <wdf.h>
     3.7 +#if (NTDDI_VERSION < NTDDI_WINXP) /* srb.h causes warnings under 2K for some reason */
     3.8 +#pragma warning(disable:4201) /* nameless struct/union */
     3.9 +#pragma warning(disable:4214) /* bit field types other than int */
    3.10 +#endif
    3.11  #include <srb.h>
    3.12  #include <ntstrsafe.h>
    3.13  #include "xen_windows.h"
     4.1 --- a/xenvbd_scsiport/xenvbd.c	Mon Feb 11 20:59:11 2013 +1100
     4.2 +++ b/xenvbd_scsiport/xenvbd.c	Mon Feb 11 21:04:34 2013 +1100
     4.3 @@ -38,9 +38,16 @@ static ULONG dump_mode_errors = 0;
     4.4  #define StorPortAcquireSpinLock(...) {}
     4.5  #define StorPortReleaseSpinLock(...) {}
     4.6  
     4.7 +static ULONG
     4.8 +SxxxPortGetSystemAddress(PVOID device_extension, PSCSI_REQUEST_BLOCK srb, PVOID *system_address) {
     4.9 +  UNREFERENCED_PARAMETER(device_extension);
    4.10 +  *system_address = (PUCHAR)srb->DataBuffer;
    4.11 +  return STATUS_SUCCESS;
    4.12 +}
    4.13 +
    4.14  #define SxxxPortNotification(NotificationType, DeviceExtension, ...) XenVbd_Notification##NotificationType(DeviceExtension, __VA_ARGS__)
    4.15  
    4.16 -VOID
    4.17 +static VOID
    4.18  XenVbd_NotificationRequestComplete(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb) {
    4.19    PXENVBD_SCSIPORT_DATA xvsd = (PXENVBD_SCSIPORT_DATA)xvdd->xvsd;
    4.20    srb_list_entry_t *srb_entry = srb->SrbExtension;
    4.21 @@ -251,9 +258,8 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
    4.22      xvsd->outstanding++;
    4.23      XenVbd_PutSrbOnList(xvdd, srb);
    4.24    }
    4.25 -  XenVbd_HandleEvent(xvdd); /* drain the ring */
    4.26 -  XenVbd_ProcessSrbList(xvdd); /* put new requests on */
    4.27 -  XenVbd_HandleEvent(xvdd); /* drain the ring again and also set event based on requests just added */
    4.28 +  /* HandleEvent also puts queued SRB's on the ring */
    4.29 +  XenVbd_HandleEvent(xvdd);
    4.30    /* need 2 spare slots - 1 for EVENT and 1 for STOP/START */
    4.31    if (xvsd->outstanding < 30) {
    4.32      ScsiPortNotification(NextLuRequest, xvsd, 0, 0, 0);
     5.1 --- a/xenvbd_scsiport/xenvbd.h	Mon Feb 11 20:59:11 2013 +1100
     5.2 +++ b/xenvbd_scsiport/xenvbd.h	Mon Feb 11 21:04:34 2013 +1100
     5.3 @@ -26,6 +26,11 @@ Foundation, Inc., 51 Franklin Street, Fi
     5.4  #define NTSTRSAFE_LIB
     5.5  #include <ntstrsafe.h>
     5.6  
     5.7 +#if (NTDDI_VERSION < NTDDI_WINXP) /* srb.h causes warnings under 2K for some reason */
     5.8 +#pragma warning(disable:4201) /* nameless struct/union */
     5.9 +#pragma warning(disable:4214) /* bit field types other than int */
    5.10 +#endif
    5.11 +
    5.12  #include <srb.h>
    5.13  #include <scsi.h>
    5.14  #include <ntddscsi.h>
     6.1 --- a/xenvbd_storport/xenvbd.c	Mon Feb 11 20:59:11 2013 +1100
     6.2 +++ b/xenvbd_storport/xenvbd.c	Mon Feb 11 21:04:34 2013 +1100
     6.3 @@ -35,9 +35,8 @@ static VOID XenVbd_StopRing(PXENVBD_DEVI
     6.4  static VOID XenVbd_StartRing(PXENVBD_DEVICE_DATA xvdd, BOOLEAN suspend);
     6.5  static VOID XenVbd_CompleteDisconnect(PXENVBD_DEVICE_DATA xvdd);
     6.6  
     6.7 -//static BOOLEAN XenVbd_HwSxxxResetBus(PVOID DeviceExtension, ULONG PathId);
     6.8 -
     6.9  #define SxxxPortNotification(...) StorPortNotification(__VA_ARGS__)
    6.10 +#define SxxxPortGetSystemAddress(xvdd, srb, system_address) StorPortGetSystemAddress(xvdd, srb, system_address)
    6.11  
    6.12  static BOOLEAN dump_mode = FALSE;
    6.13  #define DUMP_MODE_ERROR_LIMIT 64
    6.14 @@ -91,7 +90,7 @@ XenVbd_DisconnectWorkItem(PDEVICE_OBJECT
    6.15  
    6.16  static VOID
    6.17  XenVbd_CompleteDisconnect(PXENVBD_DEVICE_DATA xvdd) {
    6.18 -    IoQueueWorkItem(xvdd->disconnect_workitem, XenVbd_DisconnectWorkItem, DelayedWorkQueue, xvdd);
    6.19 +  IoQueueWorkItem(xvdd->disconnect_workitem, XenVbd_DisconnectWorkItem, DelayedWorkQueue, xvdd);
    6.20  }
    6.21  
    6.22  /* called in non-dump mode */
    6.23 @@ -251,113 +250,6 @@ XenVbd_HwStorInitialize(PVOID DeviceExte
    6.24    return TRUE;
    6.25  }
    6.26  
    6.27 -#if 0
    6.28 -/* called with StartIo lock held */
    6.29 -static VOID
    6.30 -XenVbd_HandleEvent(PVOID DeviceExtension)
    6.31 -{
    6.32 -  PXENVBD_DEVICE_DATA xvdd = (PXENVBD_DEVICE_DATA)DeviceExtension;
    6.33 -  PSCSI_REQUEST_BLOCK srb;
    6.34 -  RING_IDX i, rp;
    6.35 -  ULONG j;
    6.36 -  blkif_response_t *rep;
    6.37 -  //int block_count;
    6.38 -  int more_to_do = TRUE;
    6.39 -  blkif_shadow_t *shadow;
    6.40 -  srb_list_entry_t *srb_entry;
    6.41 -
    6.42 -  //if (dump_mode) FUNCTION_ENTER();
    6.43 -
    6.44 -  while (more_to_do)
    6.45 -  {
    6.46 -    rp = xvdd->ring.sring->rsp_prod;
    6.47 -    KeMemoryBarrier();
    6.48 -    for (i = xvdd->ring.rsp_cons; i != rp; i++)
    6.49 -    {
    6.50 -      rep = XenVbd_GetResponse(xvdd, i);
    6.51 -      shadow = &xvdd->shadows[rep->id & SHADOW_ID_ID_MASK];
    6.52 -      if (shadow->reset)
    6.53 -      {
    6.54 -        KdPrint((__DRIVER_NAME "     discarding reset shadow\n"));
    6.55 -        for (j = 0; j < shadow->req.nr_segments; j++)
    6.56 -        {
    6.57 -          XnEndAccess(xvdd->handle,
    6.58 -            shadow->req.seg[j].gref, FALSE, xvdd->grant_tag);
    6.59 -        }
    6.60 -      }
    6.61 -      else if (dump_mode && !(rep->id & SHADOW_ID_DUMP_FLAG))
    6.62 -      {
    6.63 -        KdPrint((__DRIVER_NAME "     discarding stale (non-dump-mode) shadow\n"));
    6.64 -      }
    6.65 -      else
    6.66 -      {
    6.67 -        srb = shadow->srb;
    6.68 -        NT_ASSERT(srb);
    6.69 -        srb_entry = srb->SrbExtension;
    6.70 -        NT_ASSERT(srb_entry);
    6.71 -        /* a few errors occur in dump mode because Xen refuses to allow us to map pages we are using for other stuff. Just ignore them */
    6.72 -        if (rep->status == BLKIF_RSP_OKAY || (dump_mode &&  dump_mode_errors++ < DUMP_MODE_ERROR_LIMIT))
    6.73 -          srb->SrbStatus = SRB_STATUS_SUCCESS;
    6.74 -        else
    6.75 -        {
    6.76 -          KdPrint((__DRIVER_NAME "     Xen Operation returned error\n"));
    6.77 -          if (decode_cdb_is_read(srb))
    6.78 -            KdPrint((__DRIVER_NAME "     Operation = Read\n"));
    6.79 -          else
    6.80 -            KdPrint((__DRIVER_NAME "     Operation = Write\n"));
    6.81 -          srb_entry->error = TRUE;
    6.82 -        }
    6.83 -        if (shadow->aligned_buffer_in_use)
    6.84 -        {
    6.85 -          NT_ASSERT(xvdd->aligned_buffer_in_use);
    6.86 -          xvdd->aligned_buffer_in_use = FALSE;
    6.87 -          if (srb->SrbStatus == SRB_STATUS_SUCCESS && decode_cdb_is_read(srb))
    6.88 -            memcpy((PUCHAR)shadow->system_address, xvdd->aligned_buffer, shadow->length);
    6.89 -        }
    6.90 -        for (j = 0; j < shadow->req.nr_segments; j++)
    6.91 -        {
    6.92 -          XnEndAccess(xvdd->handle, shadow->req.seg[j].gref, FALSE, xvdd->grant_tag);
    6.93 -        }
    6.94 -        srb_entry->outstanding_requests--;
    6.95 -        if (!srb_entry->outstanding_requests && srb_entry->offset == srb_entry->length)
    6.96 -        {
    6.97 -          if (srb_entry->error)
    6.98 -          {
    6.99 -            srb->SrbStatus = SRB_STATUS_ERROR;
   6.100 -            srb->ScsiStatus = 0x02;
   6.101 -            xvdd->last_sense_key = SCSI_SENSE_MEDIUM_ERROR;
   6.102 -            xvdd->last_additional_sense_code = SCSI_ADSENSE_NO_SENSE;
   6.103 -            XenVbd_MakeAutoSense(xvdd, srb);
   6.104 -          }        
   6.105 -          StorPortNotification(RequestComplete, xvdd, srb);
   6.106 -        }
   6.107 -      }
   6.108 -      put_shadow_on_freelist(xvdd, shadow);
   6.109 -    }
   6.110 -
   6.111 -    xvdd->ring.rsp_cons = i;
   6.112 -    if (i != xvdd->ring.req_prod_pvt)
   6.113 -    {
   6.114 -      RING_FINAL_CHECK_FOR_RESPONSES(&xvdd->ring, more_to_do);
   6.115 -    }
   6.116 -    else
   6.117 -    {
   6.118 -      xvdd->ring.sring->rsp_event = i + 1;
   6.119 -      more_to_do = FALSE;
   6.120 -    }
   6.121 -  }
   6.122 -
   6.123 -  if (dump_mode || xvdd->device_state == DEVICE_STATE_ACTIVE) {
   6.124 -    XenVbd_ProcessSrbList(xvdd);
   6.125 -  } else if (xvdd->shadow_free == SHADOW_ENTRIES) {
   6.126 -    FUNCTION_MSG("ring now empty - scheduling workitem for disconnect\n");
   6.127 -    IoQueueWorkItem(xvdd->disconnect_workitem, XenVbd_DisconnectWorkItem, DelayedWorkQueue, xvdd);
   6.128 -  }
   6.129 -  //if (dump_mode) FUNCTION_EXIT();
   6.130 -  return;
   6.131 -}
   6.132 -#endif
   6.133 -
   6.134  static VOID
   6.135  XenVbd_HandleEventDpc(PSTOR_DPC dpc, PVOID DeviceExtension, PVOID arg1, PVOID arg2) {
   6.136    STOR_LOCK_HANDLE lock_handle;
   6.137 @@ -389,79 +281,6 @@ XenVbd_HwStorInterrupt(PVOID DeviceExten
   6.138    return TRUE;
   6.139  }
   6.140  
   6.141 -#if 0
   6.142 -static BOOLEAN
   6.143 -XenVbd_HwSxxxResetBus(PVOID DeviceExtension, ULONG PathId)
   6.144 -{
   6.145 -  PXENVBD_DEVICE_DATA xvdd = DeviceExtension;
   6.146 -  //srb_list_entry_t *srb_entry;
   6.147 -  int i;
   6.148 -  /* need to make sure that each SRB is only reset once */
   6.149 -  LIST_ENTRY srb_reset_list;
   6.150 -  PLIST_ENTRY list_entry;
   6.151 -  //STOR_LOCK_HANDLE lock_handle;
   6.152 -
   6.153 -  UNREFERENCED_PARAMETER(PathId);
   6.154 -
   6.155 -  FUNCTION_ENTER();
   6.156 -  
   6.157 -  if (dump_mode) {
   6.158 -    FUNCTION_MSG("dump mode - doing nothing\n");
   6.159 -    FUNCTION_EXIT();
   6.160 -    return TRUE;
   6.161 -  }
   6.162 -
   6.163 -  /* It appears that the StartIo spinlock is already held at this point */
   6.164 -
   6.165 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   6.166 -
   6.167 -  xvdd->aligned_buffer_in_use = FALSE;
   6.168 -  
   6.169 -  InitializeListHead(&srb_reset_list);
   6.170 -  
   6.171 -  while((list_entry = RemoveHeadList(&xvdd->srb_list)) != &xvdd->srb_list) {
   6.172 -    #if DBG
   6.173 -    srb_list_entry_t *srb_entry = CONTAINING_RECORD(list_entry, srb_list_entry_t, list_entry);
   6.174 -    KdPrint((__DRIVER_NAME "     adding queued SRB %p to reset list\n", srb_entry->srb));
   6.175 -    #endif
   6.176 -    InsertTailList(&srb_reset_list, list_entry);
   6.177 -  }
   6.178 -  
   6.179 -  for (i = 0; i < MAX_SHADOW_ENTRIES; i++) {
   6.180 -    if (xvdd->shadows[i].srb) {
   6.181 -      srb_list_entry_t *srb_entry = xvdd->shadows[i].srb->SrbExtension;
   6.182 -      for (list_entry = srb_reset_list.Flink; list_entry != &srb_reset_list; list_entry = list_entry->Flink) {
   6.183 -        if (list_entry == &srb_entry->list_entry)
   6.184 -          break;
   6.185 -      }
   6.186 -      if (list_entry == &srb_reset_list) {
   6.187 -        KdPrint((__DRIVER_NAME "     adding in-flight SRB %p to reset list\n", srb_entry->srb));
   6.188 -        InsertTailList(&srb_reset_list, &srb_entry->list_entry);
   6.189 -      }
   6.190 -      /* set reset here so that the interrupt won't do anything with the srb but will dispose of the shadow entry correctly */
   6.191 -      xvdd->shadows[i].reset = TRUE;
   6.192 -      xvdd->shadows[i].srb = NULL;
   6.193 -      xvdd->shadows[i].aligned_buffer_in_use = FALSE;
   6.194 -    }
   6.195 -  }
   6.196 -
   6.197 -  while((list_entry = RemoveHeadList(&srb_reset_list)) != &srb_reset_list) {
   6.198 -    srb_list_entry_t *srb_entry = CONTAINING_RECORD(list_entry, srb_list_entry_t, list_entry);
   6.199 -    srb_entry->srb->SrbStatus = SRB_STATUS_BUS_RESET;
   6.200 -    KdPrint((__DRIVER_NAME "     completing SRB %p with status SRB_STATUS_BUS_RESET\n", srb_entry->srb));
   6.201 -    StorPortNotification(RequestComplete, xvdd, srb_entry->srb);
   6.202 -  }
   6.203 -
   6.204 -  /* send a notify to Dom0 just in case it was missed for some reason (which should _never_ happen normally but could in dump mode) */
   6.205 -  XnNotify(xvdd->handle, xvdd->event_channel);
   6.206 -
   6.207 -  StorPortNotification(NextRequest, DeviceExtension);
   6.208 -  FUNCTION_EXIT();
   6.209 -
   6.210 -  return TRUE;
   6.211 -}
   6.212 -#endif
   6.213 -
   6.214  static BOOLEAN
   6.215  XenVbd_HwStorResetBus(PVOID DeviceExtension, ULONG PathId)
   6.216  {
   6.217 @@ -496,9 +315,10 @@ XenVbd_HwStorStartIo(PVOID DeviceExtensi
   6.218      StorPortReleaseSpinLock (DeviceExtension, &lock_handle);
   6.219      return TRUE;
   6.220    }
   6.221 +  XenVbd_PutSrbOnList(xvdd, srb);
   6.222  
   6.223 -  XenVbd_PutSrbOnList(xvdd, srb);
   6.224 -  XenVbd_ProcessSrbList(xvdd);
   6.225 +  /* HandleEvent also puts queued SRB's on the ring */
   6.226 +  XenVbd_HandleEvent(xvdd);
   6.227    StorPortReleaseSpinLock (DeviceExtension, &lock_handle);
   6.228    //if (dump_mode) FUNCTION_EXIT();
   6.229    return TRUE;
   6.230 @@ -586,7 +406,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   6.231      VHwInitializationData.DeviceExtensionSize = FIELD_OFFSET(XENVBD_DEVICE_DATA, aligned_buffer_data) + UNALIGNED_BUFFER_DATA_SIZE;
   6.232      VHwInitializationData.SpecificLuExtensionSize = 0;
   6.233      VHwInitializationData.SrbExtensionSize = sizeof(srb_list_entry_t);
   6.234 -    VHwInitializationData.NumberOfAccessRanges = 1;
   6.235 +    VHwInitializationData.NumberOfAccessRanges = 0;
   6.236      VHwInitializationData.MapBuffers = STOR_MAP_ALL_BUFFERS;
   6.237      //VHwInitializationData.NeedPhysicalAddresses  = TRUE;
   6.238      VHwInitializationData.TaggedQueuing = TRUE;
   6.239 @@ -606,7 +426,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
   6.240      HwInitializationData.AdapterInterfaceType = Internal; //PNPBus; /* not Internal */
   6.241      HwInitializationData.DeviceExtensionSize = FIELD_OFFSET(XENVBD_DEVICE_DATA, aligned_buffer_data) + UNALIGNED_BUFFER_DATA_SIZE_DUMP_MODE;
   6.242      HwInitializationData.SrbExtensionSize = sizeof(srb_list_entry_t);
   6.243 -    HwInitializationData.NumberOfAccessRanges = 1;
   6.244 +    HwInitializationData.NumberOfAccessRanges = 0;
   6.245      HwInitializationData.MapBuffers = STOR_MAP_NON_READ_WRITE_BUFFERS;
   6.246      HwInitializationData.NeedPhysicalAddresses  = TRUE;
   6.247      HwInitializationData.TaggedQueuing = FALSE;