win-pvdrivers

changeset 1092:85b99b9795a6

Removed xenscsi as it was badly broken. Any future attempt at implementing xenscsi would likely use xenvbd
author James Harper <james.harper@bendigoit.com.au>
date Sat Jan 04 18:17:51 2014 +1100 (2014-01-04)
parents 08052dfc8750
children 5be1f70687ad
files archive.bat installer.wxs quicksign.bat sign.bat xenscsi/makefile xenscsi/makefile.inc xenscsi/sources xenscsi/xenscsi.c xenscsi/xenscsi.h xenscsi/xenscsi.inx xenscsi/xenscsi.rc
line diff
     1.1 --- a/archive.bat	Sat Jan 04 18:17:02 2014 +1100
     1.2 +++ b/archive.bat	Sat Jan 04 18:17:51 2014 +1100
     1.3 @@ -12,7 +12,6 @@ SET SYMFILES=%SYMFILES% xenvbd_filter\%B
     1.4  
     1.5  IF %DDK_TARGET_OS%==Win2K GOTO symfiles_done
     1.6  
     1.7 -SET SYMFILES=%SYMFILES% xenscsi\%BUILDDIR%\xen*.sys xenscsi\%BUILDDIR%\xen*.pdb
     1.8  SET SYMFILES=%SYMFILES% xenusb\%BUILDDIR%\xen*.sys xenusb\%BUILDDIR%\xen*.pdb
     1.9  
    1.10  IF %DDK_TARGET_OS%==WinXP GOTO symfiles_done
     2.1 --- a/installer.wxs	Sat Jan 04 18:17:02 2014 +1100
     2.2 +++ b/installer.wxs	Sat Jan 04 18:17:51 2014 +1100
     2.3 @@ -99,16 +99,6 @@
     2.4                </Component>
     2.5              </Directory>
     2.6              <?endif ?>
     2.7 -            <?if $(env.DDK_TARGET_OS) != Win2K ?>
     2.8 -            <Directory Id='XenScsiDir' Name='xenscsi'>
     2.9 -              <Component Id='XenScsi' Guid='47C9AB48-3A7D-42b2-AE2C-7F9235C8B7B4'>
    2.10 -                <File Id='xenscsi.cat' Name='xenscsi.cat' DiskId='1' Source='xenscsi\obj$(env.BUILD_ALT_DIR)\$(var.ARCHDIR)\xenscsi.cat' />
    2.11 -                <File Id='xenscsi.inf' Name='xenscsi.inf' DiskId='1' Source='xenscsi\obj$(env.BUILD_ALT_DIR)\$(var.ARCHDIR)\xenscsi.inf' />
    2.12 -                <File Id='xenscsi.sys' Name='xenscsi.sys' DiskId='1' Source='xenscsi\obj$(env.BUILD_ALT_DIR)\$(var.ARCHDIR)\xenscsi.sys' />
    2.13 -                <difx:Driver Sequence='2' Legacy='yes' PlugAndPlayPrompt='no' ForceInstall='yes' />
    2.14 -              </Component>
    2.15 -            </Directory>
    2.16 -            <?endif ?>
    2.17              <Directory Id='XenNetDir' Name='xennet'>
    2.18                <Component Id='XenNet' Guid='F16B1EC7-35B1-42c2-9017-22DC23D80BE7'>
    2.19                  <File Id='xennet.cat' Name='xennet.cat' DiskId='1' Source='xennet\obj$(env.BUILD_ALT_DIR)\$(var.ARCHDIR)\xennet.cat' />
    2.20 @@ -160,11 +150,6 @@
    2.21        <Feature Id='XenVbd' Title='XenVbd Driver' Level='1' AllowAdvertise='no' InstallDefault='local' Absent='allow'>
    2.22          <ComponentRef Id='XenVbd' />
    2.23        </Feature>
    2.24 -      <?if $(env.DDK_TARGET_OS) != Win2K ?>
    2.25 -      <Feature Id='XenScsi' Title='XenScsi Driver' Level='1' AllowAdvertise='no' InstallDefault='local' Absent='allow'>
    2.26 -        <ComponentRef Id='XenScsi' />
    2.27 -      </Feature>
    2.28 -      <?endif ?>
    2.29        <Feature Id='XenNet' Title='XenNet Driver' Level='1' AllowAdvertise='no' InstallDefault='local' Absent='allow'>
    2.30          <ComponentRef Id='XenNet' />
    2.31        </Feature>
     3.1 --- a/quicksign.bat	Sat Jan 04 18:17:02 2014 +1100
     3.2 +++ b/quicksign.bat	Sat Jan 04 18:17:51 2014 +1100
     3.3 @@ -33,6 +33,5 @@ IF DEFINED CERT_PASSWORD SET CERT_PASSWO
     3.4  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xenvbd_filter\%BUILDDIR%\xenvbd_filter.sys
     3.5  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xenvbd_storport\%BUILDDIR%\xenvbd.sys
     3.6  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xennet\%BUILDDIR%\xennet.sys
     3.7 -%SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xenscsi\%BUILDDIR%\xenscsi.sys
     3.8  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xenusb\%BUILDDIR%\xenusb.sys
     3.9  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timstamp.dll xencache\%BUILDDIR%\xencache.sys
     4.1 --- a/sign.bat	Sat Jan 04 18:17:02 2014 +1100
     4.2 +++ b/sign.bat	Sat Jan 04 18:17:51 2014 +1100
     4.3 @@ -16,8 +16,8 @@ ECHO BUILDDIR=%BUILDDIR%
     4.4  ECHO SIGN_OS=%SIGN_OS%
     4.5  
     4.6  for /F %%x in ('DIR /B %BASEDIR%\redist\wdf\%_BUILDARCH%\WdfCoInstaller?????.dll') do set WDFFILENAME=%%x
     4.7 -xcopy /D %BASEDIR%\redist\wdf\%_BUILDARCH%\%WDFFILENAME% xenpci\%BUILDDIR%
     4.8 -xcopy /D %BASEDIR%\redist\wdf\%_BUILDARCH%\%WDFFILENAME% xenusb\%BUILDDIR%
     4.9 +xcopy /I /D %BASEDIR%\redist\wdf\%_BUILDARCH%\%WDFFILENAME% xenpci\%BUILDDIR%\
    4.10 +xcopy /I /D %BASEDIR%\redist\wdf\%_BUILDARCH%\%WDFFILENAME% xenusb\%BUILDDIR%\
    4.11  
    4.12  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timestamp.dll xenpci\%BUILDDIR%\xenpci.sys
    4.13  %DDK_PATH%\bin\selfsign\inf2cat /driver:xenpci\%BUILDDIR% /os:%SIGN_OS%
    4.14 @@ -35,10 +35,6 @@ COPY xenvbd_filter\%BUILDDIR%\xenvbdfilt
    4.15  
    4.16  IF %DDK_TARGET_OS%==Win2K GOTO DONT_SIGN
    4.17  
    4.18 -%SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timestamp.dll xenscsi\%BUILDDIR%\xenscsi.sys
    4.19 -%DDK_PATH%\bin\selfsign\inf2cat /driver:xenscsi\%BUILDDIR% /os:%SIGN_OS%
    4.20 -%SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timestamp.dll xenscsi\%BUILDDIR%\xenscsi.cat
    4.21 -
    4.22  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timestamp.dll xenusb\%BUILDDIR%\xenusb.sys
    4.23  %DDK_PATH%\bin\selfsign\inf2cat /driver:xenusb\%BUILDDIR% /os:%SIGN_OS%
    4.24  %SIGNTOOL% sign /v %CERT_CROSS_CERT_FLAG% /f %CERT_FILENAME% %CERT_PASSWORD_FLAG% /t http://timestamp.verisign.com/scripts/timestamp.dll xenusb\%BUILDDIR%\xenusb.cat
     5.1 --- a/xenscsi/makefile	Sat Jan 04 18:17:02 2014 +1100
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,1 +0,0 @@
     5.4 -!INCLUDE $(NTMAKEENV)\makefile.def
     5.5 \ No newline at end of file
     6.1 --- a/xenscsi/makefile.inc	Sat Jan 04 18:17:02 2014 +1100
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,6 +0,0 @@
     6.4 -_LNG=$(LANGUAGE)
     6.5 -STAMP=stampinf -f $@ -a $(_BUILDARCH) -d * -v $(GPLPV_VERSION)
     6.6 -
     6.7 -$(OBJ_PATH)\$(O)\$(TARGETNAME).inf: $(TARGETNAME).inx sources ..\common.inc
     6.8 -    copy $(@B).inx $@
     6.9 -    $(STAMP)
     7.1 --- a/xenscsi/sources	Sat Jan 04 18:17:02 2014 +1100
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,8 +0,0 @@
     7.4 -!include "..\common.inc"
     7.5 -!UNDEF KMDF_VERSION
     7.6 -!UNDEF KMDF_VERSION_MAJOR
     7.7 -TARGETNAME=xenscsi
     7.8 -TARGETTYPE=DRIVER
     7.9 -TARGETLIBS=$(TARGETLIBS) $(DDK_LIB_PATH)\scsiport.lib
    7.10 -NTTARGETFILES=$(NTTARGETFILES) $(OBJ_PATH)\$(O)\$(TARGETNAME).inf
    7.11 -SOURCES=xenscsi.rc xenscsi.c
     8.1 --- a/xenscsi/xenscsi.c	Sat Jan 04 18:17:02 2014 +1100
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,893 +0,0 @@
     8.4 -/*
     8.5 -PV Drivers for Windows Xen HVM Domains
     8.6 -Copyright (C) 2007 James Harper
     8.7 -
     8.8 -This program is free software; you can redistribute it and/or
     8.9 -modify it under the terms of the GNU General Public License
    8.10 -as published by the Free Software Foundation; either version 2
    8.11 -of the License, or (at your option) any later version.
    8.12 -
    8.13 -This program is distributed in the hope that it will be useful,
    8.14 -but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.15 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    8.16 -GNU General Public License for more details.
    8.17 -
    8.18 -You should have received a copy of the GNU General Public License
    8.19 -along with this program; if not, write to the Free Software
    8.20 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
    8.21 -*/
    8.22 -
    8.23 -#include "xenscsi.h"
    8.24 -
    8.25 -/* Not really necessary but keeps PREfast happy */
    8.26 -DRIVER_INITIALIZE DriverEntry;
    8.27 -
    8.28 -#ifdef ALLOC_PRAGMA
    8.29 -#pragma alloc_text (INIT, DriverEntry)
    8.30 -#endif
    8.31 -
    8.32 -#pragma warning(disable: 4127)
    8.33 -
    8.34 -static BOOLEAN dump_mode = FALSE;
    8.35 -
    8.36 -static vscsiif_shadow_t *
    8.37 -get_shadow_from_freelist(PXENSCSI_DEVICE_DATA xsdd)
    8.38 -{
    8.39 -  if (xsdd->shadow_free == 0)
    8.40 -  {
    8.41 -    KdPrint((__DRIVER_NAME "     No more shadow entries\n"));    
    8.42 -    return NULL;
    8.43 -  }
    8.44 -  xsdd->shadow_free--;
    8.45 -  return &xsdd->shadows[xsdd->shadow_free_list[xsdd->shadow_free]];
    8.46 -}
    8.47 -
    8.48 -static VOID
    8.49 -put_shadow_on_freelist(PXENSCSI_DEVICE_DATA xsdd, vscsiif_shadow_t *shadow)
    8.50 -{
    8.51 -  xsdd->shadow_free_list[xsdd->shadow_free] = (USHORT)shadow->req.rqid;
    8.52 -  shadow->Srb = NULL;
    8.53 -  xsdd->shadow_free++;
    8.54 -}
    8.55 -
    8.56 -static grant_ref_t
    8.57 -get_grant_from_freelist(PXENSCSI_DEVICE_DATA xsdd)
    8.58 -{
    8.59 -  if (xsdd->grant_free == 0)
    8.60 -  {
    8.61 -    KdPrint((__DRIVER_NAME "     No more grant refs\n"));    
    8.62 -    return (grant_ref_t)0x0FFFFFFF;
    8.63 -  }
    8.64 -  xsdd->grant_free--;
    8.65 -  return xsdd->grant_free_list[xsdd->grant_free];
    8.66 -}
    8.67 -
    8.68 -static VOID
    8.69 -put_grant_on_freelist(PXENSCSI_DEVICE_DATA xsdd, grant_ref_t grant)
    8.70 -{
    8.71 -  xsdd->grant_free_list[xsdd->grant_free] = grant;
    8.72 -  xsdd->grant_free++;
    8.73 -}
    8.74 -
    8.75 -static VOID
    8.76 -XenScsi_CheckNewDevice(PVOID DeviceExtension)
    8.77 -{
    8.78 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
    8.79 -
    8.80 -  //FUNCTION_ENTER();
    8.81 -  
    8.82 -  if (InterlockedCompareExchange(&xsdd->shared_paused, SHARED_PAUSED_SCSIPORT_PAUSED, SHARED_PAUSED_PASSIVE_PAUSED) == SHARED_PAUSED_PASSIVE_PAUSED)
    8.83 -  {
    8.84 -    KdPrint((__DRIVER_NAME "     scsiport paused\n"));
    8.85 -    xsdd->scsiport_paused = TRUE;
    8.86 -  }
    8.87 -  if (InterlockedCompareExchange(&xsdd->shared_paused, SHARED_PAUSED_SCSIPORT_UNPAUSED, SHARED_PAUSED_PASSIVE_UNPAUSED) == SHARED_PAUSED_PASSIVE_UNPAUSED)
    8.88 -  {
    8.89 -    int i;
    8.90 -    KdPrint((__DRIVER_NAME "     scsiport unpaused\n"));
    8.91 -    xsdd->scsiport_paused = FALSE;
    8.92 -    for (i = 0; i < 8; i++)
    8.93 -    {  
    8.94 -      if (xsdd->bus_changes[i])
    8.95 -      {
    8.96 -        KdPrint((__DRIVER_NAME "     Sending BusChangeDetected for channel %d\n", i));
    8.97 -        ScsiPortNotification(BusChangeDetected, DeviceExtension, i);
    8.98 -      }
    8.99 -    }
   8.100 -    ScsiPortNotification(NextRequest, DeviceExtension);
   8.101 -  }
   8.102 -  if (xsdd->scsiport_paused) /* check more often if we are paused */
   8.103 -    ScsiPortNotification(RequestTimerCall, DeviceExtension, XenScsi_CheckNewDevice, 100 * 1000); /* 100ms second from the last check */
   8.104 -  else
   8.105 -    ScsiPortNotification(RequestTimerCall, DeviceExtension, XenScsi_CheckNewDevice, 1 * 1000 * 1000); /* 1 second from the last check */
   8.106 -  //FUNCTION_EXIT();
   8.107 -}
   8.108 -
   8.109 -static BOOLEAN
   8.110 -XenScsi_HwScsiInterrupt(PVOID DeviceExtension)
   8.111 -{
   8.112 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
   8.113 -  PSCSI_REQUEST_BLOCK Srb;
   8.114 -  RING_IDX i, rp;
   8.115 -  int j;
   8.116 -  vscsiif_response_t *rep;
   8.117 -  int more_to_do = TRUE;
   8.118 -  vscsiif_shadow_t *shadow;
   8.119 -  BOOLEAN last_interrupt = FALSE;
   8.120 -
   8.121 -  XenScsi_CheckNewDevice(DeviceExtension);
   8.122 -
   8.123 -  if (!dump_mode && !xsdd->vectors.EvtChn_AckEvent(xsdd->vectors.context, xsdd->event_channel, &last_interrupt))
   8.124 -  {
   8.125 -    return FALSE;
   8.126 -  }
   8.127 -
   8.128 -  //FUNCTION_ENTER();
   8.129 -  
   8.130 -  while (more_to_do)
   8.131 -  {
   8.132 -    rp = xsdd->ring.sring->rsp_prod;
   8.133 -    KeMemoryBarrier();
   8.134 -    for (i = xsdd->ring.rsp_cons; i != rp; i++)
   8.135 -    {
   8.136 -      rep = RING_GET_RESPONSE(&xsdd->ring, i);
   8.137 -      shadow = &xsdd->shadows[rep->rqid];
   8.138 -      Srb = shadow->Srb;
   8.139 -      Srb->ScsiStatus = (UCHAR)rep->rslt;
   8.140 -      memset(Srb->SenseInfoBuffer, 0, Srb->SenseInfoBufferLength);
   8.141 -      if (rep->sense_len > 0 && Srb->SenseInfoBuffer != NULL)
   8.142 -      {
   8.143 -        memcpy(Srb->SenseInfoBuffer, rep->sense_buffer, min(Srb->SenseInfoBufferLength, rep->sense_len));
   8.144 -      }
   8.145 -      switch(rep->rslt)
   8.146 -      {
   8.147 -      case 0:
   8.148 -        //KdPrint((__DRIVER_NAME "     Xen Operation complete - result = 0x%08x, sense_len = %d, residual = %d\n", rep->rslt, rep->sense_len, rep->residual_len));
   8.149 -        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   8.150 -        if (Srb->Cdb[0] == 0x03)
   8.151 -        {
   8.152 -          KdPrint((__DRIVER_NAME "     REQUEST_SENSE DataTransferLength = %d, residual = %d\n", Srb->DataTransferLength, rep->residual_len));
   8.153 -          //for (j = 0; j < Srb->DataTransferLength - rep->residual_len; j++)
   8.154 -          //  KdPrint((__DRIVER_NAME "     sense %02x: %02x\n", j, (ULONG)((PUCHAR)Srb->DataBuffer)[j]));
   8.155 -        }
   8.156 -        break;
   8.157 -      case 0x00010000: /* Device does not exist */
   8.158 -        KdPrint((__DRIVER_NAME "     Xen Operation error - cdb[0] = %02x, result = 0x%08x, sense_len = %d, residual = %d\n", (ULONG)Srb->Cdb[0], rep->rslt, rep->sense_len, rep->residual_len));
   8.159 -        Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
   8.160 -        break;
   8.161 -      default:
   8.162 -        KdPrint((__DRIVER_NAME "     Xen Operation error - cdb[0] = %02x, result = 0x%08x, sense_len = %d, residual = %d\n", (ULONG)Srb->Cdb[0], rep->rslt, rep->sense_len, rep->residual_len));
   8.163 -        Srb->SrbStatus = SRB_STATUS_ERROR;
   8.164 -
   8.165 -        //for (j = 0; j < Srb->SenseInfoBufferLength; j++)
   8.166 -        //  KdPrint((__DRIVER_NAME "     sense %02x: %02x\n", j, (ULONG)((PUCHAR)Srb->SenseInfoBuffer)[j]));
   8.167 -
   8.168 -        if (rep->sense_len > 0 && !(Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE) && Srb->SenseInfoBuffer != NULL)
   8.169 -        {
   8.170 -          KdPrint((__DRIVER_NAME "     Doing autosense\n"));
   8.171 -          Srb->SrbStatus |= SRB_STATUS_AUTOSENSE_VALID;
   8.172 -        }
   8.173 -        else if (Srb->SrbFlags & SRB_FLAGS_DISABLE_AUTOSENSE)
   8.174 -        {
   8.175 -          PXENSCSI_LU_DATA lud = ScsiPortGetLogicalUnit(DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
   8.176 -          KdPrint((__DRIVER_NAME "     Autosense disabled\n"));
   8.177 -          if (lud != NULL)
   8.178 -          {
   8.179 -            KdPrint((__DRIVER_NAME "     Saving sense data\n"));
   8.180 -            lud->sense_len = rep->sense_len;
   8.181 -            memcpy(lud->sense_buffer, Srb->SenseInfoBuffer, lud->sense_len);
   8.182 -          }
   8.183 -        }
   8.184 -      }
   8.185 -
   8.186 -      /* work around a bug in scsiback that gives an incorrect result to REPORT_LUNS - fail it if the output is only 8 bytes */
   8.187 -      if (Srb->Cdb[0] == 0xa0 && Srb->SrbStatus == SRB_STATUS_SUCCESS &&
   8.188 -        Srb->DataTransferLength - rep->residual_len == 8)
   8.189 -      {
   8.190 -        /* SRB_STATUS_ERROR appears to be sufficient here - no need to worry about sense data or anything */
   8.191 -        KdPrint((__DRIVER_NAME "     Worked around bad REPORT_LUNS emulation for %d:%d:%d\n",
   8.192 -          Srb->PathId, Srb->TargetId, Srb->Lun));
   8.193 -        Srb->SrbStatus = SRB_STATUS_ERROR;
   8.194 -      }
   8.195 -      //remaining = Srb->DataTransferLength;
   8.196 -      for (j = 0; j < shadow->req.nr_segments; j++)
   8.197 -      {
   8.198 -        xsdd->vectors.GntTbl_EndAccess(xsdd->vectors.context, shadow->req.seg[j].gref, TRUE, (ULONG)'SCSI');
   8.199 -        put_grant_on_freelist(xsdd, shadow->req.seg[j].gref);
   8.200 -        shadow->req.seg[j].gref = 0;
   8.201 -      }
   8.202 -
   8.203 -      if (Srb->SrbStatus == SRB_STATUS_SUCCESS && rep->residual_len)
   8.204 -      {
   8.205 -//        KdPrint((__DRIVER_NAME "     SRB_STATUS_DATA_OVERRUN DataTransferLength = %d, adjusted = %d\n",
   8.206 -//          Srb->DataTransferLength, Srb->DataTransferLength - rep->residual_len));
   8.207 -        Srb->DataTransferLength -= rep->residual_len;
   8.208 -        Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
   8.209 -      }
   8.210 -
   8.211 -      put_shadow_on_freelist(xsdd, shadow);
   8.212 -      ScsiPortNotification(RequestComplete, xsdd, Srb);
   8.213 -      if (!xsdd->scsiport_paused)
   8.214 -        ScsiPortNotification(NextRequest, DeviceExtension);
   8.215 -    }
   8.216 -
   8.217 -    xsdd->ring.rsp_cons = i;
   8.218 -    if (i != xsdd->ring.req_prod_pvt)
   8.219 -    {
   8.220 -      RING_FINAL_CHECK_FOR_RESPONSES(&xsdd->ring, more_to_do);
   8.221 -    }
   8.222 -    else
   8.223 -    {
   8.224 -      xsdd->ring.sring->rsp_event = i + 1;
   8.225 -      more_to_do = FALSE;
   8.226 -    }
   8.227 -  }
   8.228 -
   8.229 -  //FUNCTION_EXIT();
   8.230 -  
   8.231 -  return last_interrupt;
   8.232 -}
   8.233 -
   8.234 -static VOID
   8.235 -XenScsi_ParseBackendDevice(scsi_dev_t *dev, PCHAR value)
   8.236 -{
   8.237 -  int i = 0;
   8.238 -  int j = 0;
   8.239 -  BOOLEAN scanning = TRUE;
   8.240 -
   8.241 -  while (scanning)
   8.242 -  {
   8.243 -    if (value[i] == 0)
   8.244 -      scanning = FALSE;
   8.245 -    if (value[i] == ':' || value[i] == 0)
   8.246 -    {
   8.247 -       value[i] = 0;
   8.248 -       dev->host = dev->channel;
   8.249 -       dev->channel = dev->id;
   8.250 -       dev->id = dev->lun;
   8.251 -       dev->lun = (UCHAR)atoi(&value[j]);
   8.252 -       j = i + 1;
   8.253 -    }
   8.254 -    i++;
   8.255 -  }
   8.256 -  KdPrint((__DRIVER_NAME "     host = %d, channel = %d, id = %d, lun = %d\n",
   8.257 -    dev->host, dev->channel, dev->id, dev->lun));  
   8.258 -}
   8.259 -
   8.260 -/* CALLED AT PASSIVE LEVEL */
   8.261 -/* If Initialize fails then the watch still gets called but the waits will never be acked... */
   8.262 -static VOID
   8.263 -XenScsi_DevWatch(PCHAR path, PVOID DeviceExtension)
   8.264 -{
   8.265 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
   8.266 -  CHAR tmp_path[128];
   8.267 -  PCHAR msg;
   8.268 -  PCHAR *devices;
   8.269 -  PCHAR value;
   8.270 -  scsi_dev_t *dev;
   8.271 -  ULONG i;
   8.272 -  ULONG dev_no;
   8.273 -  ULONG state;
   8.274 -  LARGE_INTEGER wait_time;
   8.275 -  #if DBG
   8.276 -  ULONG oldpause;
   8.277 -  #endif
   8.278 -
   8.279 -  UNREFERENCED_PARAMETER(path);
   8.280 -  
   8.281 -  /* this can only be called from a watch and so is always serialised */
   8.282 -  FUNCTION_ENTER();
   8.283 -
   8.284 -  #if DBG
   8.285 -  oldpause =
   8.286 -  #endif
   8.287 -    InterlockedExchange(&xsdd->shared_paused, SHARED_PAUSED_PASSIVE_PAUSED);
   8.288 -  ASSERT(oldpause == SHARED_PAUSED_SCSIPORT_UNPAUSED);
   8.289 -  
   8.290 -  while (InterlockedCompareExchange(&xsdd->shared_paused, SHARED_PAUSED_SCSIPORT_PAUSED, SHARED_PAUSED_SCSIPORT_PAUSED) != SHARED_PAUSED_SCSIPORT_PAUSED)
   8.291 -  {
   8.292 -    KdPrint((__DRIVER_NAME "     Waiting for pause...\n"));
   8.293 -    wait_time.QuadPart = -100 * 1000 * 10; /* 100ms */
   8.294 -    KeDelayExecutionThread(KernelMode, FALSE, &wait_time);
   8.295 -  }
   8.296 -  
   8.297 -  KdPrint((__DRIVER_NAME "     Watch triggered on %s\n", path));
   8.298 -  RtlStringCbCopyA(tmp_path, ARRAY_SIZE(tmp_path), xsdd->vectors.backend_path);
   8.299 -  RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/vscsi-devs");
   8.300 -  msg = xsdd->vectors.XenBus_List(xsdd->vectors.context, XBT_NIL, tmp_path, &devices);
   8.301 -  if (msg)
   8.302 -  {
   8.303 -    /* this is pretty fatal ... */
   8.304 -    KdPrint((__DRIVER_NAME "     cannot read - %s\n", msg));
   8.305 -    return;
   8.306 -  }
   8.307 -  for (dev = (scsi_dev_t *)xsdd->dev_list_head.Flink;
   8.308 -    dev != (scsi_dev_t *)&xsdd->dev_list_head;
   8.309 -    dev = (scsi_dev_t *)dev->entry.Flink)
   8.310 -  {
   8.311 -    dev->validated = FALSE;
   8.312 -  }
   8.313 -  
   8.314 -  for (i = 0; devices[i]; i++)
   8.315 -  {
   8.316 -    if (strncmp(devices[i], "dev-", 4) != 0)
   8.317 -    {
   8.318 -      XenPci_FreeMem(devices[i]);
   8.319 -      break; /* not a dev so we are not interested */
   8.320 -    }
   8.321 -    dev_no = atoi(devices[i] + 4);
   8.322 -    RtlStringCbCopyA(tmp_path, ARRAY_SIZE(tmp_path), xsdd->vectors.backend_path);
   8.323 -    RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/vscsi-devs/");
   8.324 -    RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), devices[i]);
   8.325 -    RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/state");
   8.326 -    msg = xsdd->vectors.XenBus_Read(xsdd->vectors.context, XBT_NIL, tmp_path, &value);
   8.327 -    if (msg)
   8.328 -    {
   8.329 -      KdPrint((__DRIVER_NAME "     failed to read state for device %d\n", dev_no));
   8.330 -      state = 0;
   8.331 -    }
   8.332 -    else
   8.333 -      state = atoi(value);
   8.334 -    for (dev = (scsi_dev_t *)xsdd->dev_list_head.Flink;
   8.335 -      dev != (scsi_dev_t *)&xsdd->dev_list_head;
   8.336 -      dev = (scsi_dev_t * )dev->entry.Flink)
   8.337 -    {
   8.338 -      if (dev->dev_no == dev_no)
   8.339 -        break;
   8.340 -    }
   8.341 -    if (dev == (scsi_dev_t *)&xsdd->dev_list_head)
   8.342 -    {
   8.343 -      KdPrint((__DRIVER_NAME "     new dev %d\n", dev_no));
   8.344 -      dev = ExAllocatePoolWithTag(NonPagedPool, sizeof(scsi_dev_t), XENSCSI_POOL_TAG);
   8.345 -      dev->dev_no = dev_no;
   8.346 -      dev->state = state;
   8.347 -      dev->validated = TRUE;
   8.348 -      RtlStringCbCopyA(tmp_path, ARRAY_SIZE(tmp_path), xsdd->vectors.backend_path);
   8.349 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/vscsi-devs/");
   8.350 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), devices[i]);
   8.351 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/v-dev");
   8.352 -      msg = xsdd->vectors.XenBus_Read(xsdd->vectors.context, XBT_NIL, tmp_path, &value);
   8.353 -      if (msg)
   8.354 -      {
   8.355 -        KdPrint((__DRIVER_NAME "     failed to read v-dev for device %d\n", dev_no));
   8.356 -        continue;
   8.357 -      }
   8.358 -      else
   8.359 -      {
   8.360 -        XenScsi_ParseBackendDevice(dev, value);
   8.361 -        // should verify that the controller = this
   8.362 -      }
   8.363 -      RtlStringCbCopyA(tmp_path, ARRAY_SIZE(tmp_path), xsdd->vectors.path);
   8.364 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/vscsi-devs/");
   8.365 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), devices[i]);
   8.366 -      RtlStringCbCatA(tmp_path, ARRAY_SIZE(tmp_path), "/state");
   8.367 -      msg = xsdd->vectors.XenBus_Write(xsdd->vectors.context, XBT_NIL, tmp_path, "4");
   8.368 -      if (msg)
   8.369 -      {
   8.370 -        KdPrint((__DRIVER_NAME "     failed to write state %d to %s\n", 4, tmp_path));
   8.371 -        continue;
   8.372 -      }
   8.373 -      KdPrint((__DRIVER_NAME "     setting changes[%d]\n", dev->channel));
   8.374 -      xsdd->bus_changes[dev->channel] = 1;
   8.375 -      InsertTailList(&xsdd->dev_list_head, (PLIST_ENTRY)dev);
   8.376 -    }
   8.377 -    else
   8.378 -    {
   8.379 -      // need to manage state change
   8.380 -      // and write frontend state
   8.381 -      dev->state = state;
   8.382 -      dev->validated = TRUE;
   8.383 -      KdPrint((__DRIVER_NAME "     existing dev %d state = %d\n", dev_no, dev->state));
   8.384 -    }
   8.385 -    XenPci_FreeMem(devices[i]);
   8.386 -  }
   8.387 -  XenPci_FreeMem(devices);
   8.388 -
   8.389 -  #if DBG
   8.390 -  oldpause =
   8.391 -  #endif
   8.392 -    InterlockedExchange(&xsdd->shared_paused, SHARED_PAUSED_PASSIVE_UNPAUSED);
   8.393 -  ASSERT(oldpause == SHARED_PAUSED_SCSIPORT_PAUSED);
   8.394 -
   8.395 -  while (InterlockedCompareExchange(&xsdd->shared_paused, SHARED_PAUSED_SCSIPORT_UNPAUSED, SHARED_PAUSED_SCSIPORT_UNPAUSED) != SHARED_PAUSED_SCSIPORT_UNPAUSED)
   8.396 -  {
   8.397 -    KdPrint((__DRIVER_NAME "     Waiting for unpause...\n"));
   8.398 -    wait_time.QuadPart = -100 * 1000 * 10; /* 100ms */
   8.399 -    KeDelayExecutionThread(KernelMode, FALSE, &wait_time);
   8.400 -  }
   8.401 -  KdPrint((__DRIVER_NAME "     Unpaused\n"));
   8.402 -
   8.403 -  FUNCTION_EXIT();
   8.404 -}
   8.405 -
   8.406 -static ULONG
   8.407 -XenScsi_HwScsiFindAdapter(PVOID DeviceExtension, PVOID Reserved1, PVOID Reserved2, PCHAR ArgumentString, PPORT_CONFIGURATION_INFORMATION ConfigInfo, PUCHAR Reserved3)
   8.408 -{
   8.409 -  ULONG i;
   8.410 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
   8.411 -  PACCESS_RANGE access_range;
   8.412 -  PUCHAR ptr;
   8.413 -  USHORT type;
   8.414 -  PCHAR setting, value, value2;
   8.415 -  vscsiif_sring_t *sring;
   8.416 -  CHAR path[128];
   8.417 -
   8.418 -  UNREFERENCED_PARAMETER(Reserved1);
   8.419 -  UNREFERENCED_PARAMETER(Reserved2);
   8.420 -  UNREFERENCED_PARAMETER(ArgumentString);
   8.421 -  UNREFERENCED_PARAMETER(Reserved3);
   8.422 -
   8.423 -  FUNCTION_ENTER();
   8.424 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   8.425 -  
   8.426 -  xsdd->scsiport_paused = TRUE; /* wait for initial scan */
   8.427 -
   8.428 -  KdPrint((__DRIVER_NAME "     BusInterruptLevel = %d\n", ConfigInfo->BusInterruptLevel));
   8.429 -  KdPrint((__DRIVER_NAME "     BusInterruptVector = %03x\n", ConfigInfo->BusInterruptVector));
   8.430 -
   8.431 -  if (!ConfigInfo->BusInterruptVector)
   8.432 -  {
   8.433 -    KdPrint((__DRIVER_NAME "     No Interrupt assigned\n"));
   8.434 -    return SP_RETURN_BAD_CONFIG;
   8.435 -  }
   8.436 -
   8.437 -  if (ConfigInfo->NumberOfAccessRanges != 1)
   8.438 -  {
   8.439 -    KdPrint((__DRIVER_NAME "     NumberOfAccessRanges = %d\n", ConfigInfo->NumberOfAccessRanges));
   8.440 -    return SP_RETURN_BAD_CONFIG;
   8.441 -  }
   8.442 -
   8.443 -  ptr = NULL;
   8.444 -  access_range = &((*(ConfigInfo->AccessRanges))[0]);
   8.445 -  KdPrint((__DRIVER_NAME "     RangeStart = %08x, RangeLength = %08x\n",
   8.446 -    access_range->RangeStart.LowPart, access_range->RangeLength));
   8.447 -  ptr = ScsiPortGetDeviceBase(
   8.448 -    DeviceExtension,
   8.449 -    ConfigInfo->AdapterInterfaceType,
   8.450 -    ConfigInfo->SystemIoBusNumber,
   8.451 -    access_range->RangeStart,
   8.452 -    access_range->RangeLength,
   8.453 -    !access_range->RangeInMemory);
   8.454 -  if (!ptr)
   8.455 -  {
   8.456 -    KdPrint((__DRIVER_NAME "     Unable to map range\n"));
   8.457 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));  
   8.458 -    return SP_RETURN_BAD_CONFIG;
   8.459 -  }
   8.460 -  sring = NULL;
   8.461 -  xsdd->event_channel = 0;
   8.462 -  while((type = GET_XEN_INIT_RSP(&ptr, &setting, &value, &value2)) != XEN_INIT_TYPE_END)
   8.463 -  {
   8.464 -    switch(type)
   8.465 -    {
   8.466 -    case XEN_INIT_TYPE_RING: /* frontend ring */
   8.467 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_RING - %s = %p\n", setting, value));
   8.468 -      if (strcmp(setting, "ring-ref") == 0)
   8.469 -      {
   8.470 -        sring = (vscsiif_sring_t *)value;
   8.471 -        FRONT_RING_INIT(&xsdd->ring, sring, PAGE_SIZE);
   8.472 -      }
   8.473 -      break;
   8.474 -    //case XEN_INIT_TYPE_EVENT_CHANNEL: /* frontend event channel */
   8.475 -    case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ: /* frontend event channel */
   8.476 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_EVENT_CHANNEL - %s = %d\n", setting, PtrToUlong(value)));
   8.477 -      if (strcmp(setting, "event-channel") == 0)
   8.478 -      {
   8.479 -        xsdd->event_channel = PtrToUlong(value);
   8.480 -      }
   8.481 -      break;
   8.482 -    case XEN_INIT_TYPE_READ_STRING_BACK:
   8.483 -    case XEN_INIT_TYPE_READ_STRING_FRONT:
   8.484 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
   8.485 -      break;
   8.486 -    case XEN_INIT_TYPE_VECTORS:
   8.487 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_VECTORS\n"));
   8.488 -      if (((PXENPCI_VECTORS)value)->length != sizeof(XENPCI_VECTORS) ||
   8.489 -        ((PXENPCI_VECTORS)value)->magic != XEN_DATA_MAGIC)
   8.490 -      {
   8.491 -        KdPrint((__DRIVER_NAME "     vectors mismatch (magic = %08x, length = %d)\n",
   8.492 -          ((PXENPCI_VECTORS)value)->magic, ((PXENPCI_VECTORS)value)->length));
   8.493 -        KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   8.494 -        return SP_RETURN_BAD_CONFIG;
   8.495 -      }
   8.496 -      else
   8.497 -        memcpy(&xsdd->vectors, value, sizeof(XENPCI_VECTORS));
   8.498 -      break;
   8.499 -    case XEN_INIT_TYPE_GRANT_ENTRIES:
   8.500 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(value)));
   8.501 -      xsdd->grant_entries = (USHORT)PtrToUlong(value);
   8.502 -      memcpy(&xsdd->grant_free_list, value2, sizeof(grant_ref_t) * xsdd->grant_entries);
   8.503 -      xsdd->grant_free = xsdd->grant_entries;
   8.504 -      break;
   8.505 -    default:
   8.506 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_%d\n", type));
   8.507 -      break;
   8.508 -    }
   8.509 -  }
   8.510 -
   8.511 -  if (sring == NULL || xsdd->event_channel == 0)
   8.512 -  {
   8.513 -    KdPrint((__DRIVER_NAME "     Missing settings\n"));
   8.514 -    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   8.515 -    return SP_RETURN_BAD_CONFIG;
   8.516 -  }
   8.517 -  
   8.518 -  ConfigInfo->ScatterGather = TRUE;
   8.519 -  ConfigInfo->NumberOfPhysicalBreaks = VSCSIIF_SG_TABLESIZE - 1;
   8.520 -  ConfigInfo->MaximumTransferLength = VSCSIIF_SG_TABLESIZE * PAGE_SIZE;
   8.521 -  ConfigInfo->CachesData = FALSE;
   8.522 -  ConfigInfo->NumberOfBuses = 4; //SCSI_MAXIMUM_BUSES; //8
   8.523 -  ConfigInfo->MaximumNumberOfTargets = 16;
   8.524 -  ConfigInfo->MaximumNumberOfLogicalUnits = SCSI_MAXIMUM_LOGICAL_UNITS; // 8
   8.525 -  ConfigInfo->BufferAccessScsiPortControlled = TRUE;
   8.526 -  if (ConfigInfo->Dma64BitAddresses == SCSI_DMA64_SYSTEM_SUPPORTED)
   8.527 -  {
   8.528 -    ConfigInfo->Master = TRUE;
   8.529 -    ConfigInfo->Dma64BitAddresses = SCSI_DMA64_MINIPORT_SUPPORTED;
   8.530 -    KdPrint((__DRIVER_NAME "     Dma64BitAddresses supported\n"));
   8.531 -  }
   8.532 -  else
   8.533 -  {
   8.534 -    ConfigInfo->Master = FALSE;
   8.535 -    KdPrint((__DRIVER_NAME "     Dma64BitAddresses not supported\n"));
   8.536 -  }
   8.537 -  ConfigInfo->InitiatorBusId[0] = 7;
   8.538 -  ConfigInfo->InitiatorBusId[1] = 7;
   8.539 -  ConfigInfo->InitiatorBusId[2] = 7;
   8.540 -  ConfigInfo->InitiatorBusId[3] = 7;
   8.541 -  xsdd->shadow_free = 0;
   8.542 -  memset(xsdd->shadows, 0, sizeof(vscsiif_shadow_t) * SHADOW_ENTRIES);
   8.543 -  for (i = 0; i < SHADOW_ENTRIES; i++)
   8.544 -  {
   8.545 -    xsdd->shadows[i].req.rqid = (USHORT)i;
   8.546 -    put_shadow_on_freelist(xsdd, &xsdd->shadows[i]);
   8.547 -  }
   8.548 -
   8.549 -  if (!dump_mode)
   8.550 -  {
   8.551 -    InitializeListHead(&xsdd->dev_list_head);
   8.552 -    /* should do something if we haven't enumerated in a certain time */
   8.553 -    RtlStringCbCopyA(path, ARRAY_SIZE(path), xsdd->vectors.backend_path);
   8.554 -    RtlStringCbCatA(path, ARRAY_SIZE(path), "/vscsi-devs");
   8.555 -    xsdd->vectors.XenBus_AddWatch(xsdd->vectors.context, XBT_NIL, path,
   8.556 -      XenScsi_DevWatch, xsdd);
   8.557 -  }
   8.558 -  FUNCTION_EXIT();
   8.559 -
   8.560 -  return SP_RETURN_FOUND;
   8.561 -}
   8.562 -
   8.563 -static BOOLEAN
   8.564 -XenScsi_HwScsiInitialize(PVOID DeviceExtension)
   8.565 -{
   8.566 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
   8.567 -  UNREFERENCED_PARAMETER(DeviceExtension);
   8.568 -
   8.569 -  FUNCTION_ENTER();
   8.570 -  xsdd->shared_paused = SHARED_PAUSED_SCSIPORT_UNPAUSED;
   8.571 -  ScsiPortNotification(RequestTimerCall, DeviceExtension, XenScsi_CheckNewDevice, 1 * 1000 * 1000); /* 1 second */
   8.572 -  
   8.573 -  FUNCTION_EXIT();
   8.574 -
   8.575 -  return TRUE;
   8.576 -}
   8.577 -
   8.578 -static VOID
   8.579 -XenScsi_PutSrbOnRing(PXENSCSI_DEVICE_DATA xsdd, PSCSI_REQUEST_BLOCK Srb)
   8.580 -{
   8.581 -  PHYSICAL_ADDRESS physical_address;
   8.582 -  ULONG remaining;
   8.583 -  PUCHAR ptr;
   8.584 -  //ULONG i;
   8.585 -  PFN_NUMBER pfn;
   8.586 -  vscsiif_shadow_t *shadow;
   8.587 -  int notify;
   8.588 -
   8.589 -  //FUNCTION_ENTER();
   8.590 -
   8.591 -  shadow = get_shadow_from_freelist(xsdd);
   8.592 -  ASSERT(shadow);
   8.593 -  shadow->Srb = Srb;
   8.594 -  shadow->req.act = VSCSIIF_ACT_SCSI_CDB;
   8.595 -  memset(shadow->req.cmnd, 0, VSCSIIF_MAX_COMMAND_SIZE);
   8.596 -  memcpy(shadow->req.cmnd, Srb->Cdb, min(Srb->CdbLength, VSCSIIF_MAX_COMMAND_SIZE));
   8.597 -  shadow->req.cmd_len = min(Srb->CdbLength, VSCSIIF_MAX_COMMAND_SIZE);
   8.598 -  shadow->req.timeout_per_command = (USHORT)Srb->TimeOutValue;
   8.599 -  shadow->req.channel = (USHORT)Srb->PathId;
   8.600 -  shadow->req.id = (USHORT)Srb->TargetId;
   8.601 -  shadow->req.lun = (USHORT)Srb->Lun;
   8.602 -  if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_IN) && (Srb->SrbFlags & SRB_FLAGS_DATA_OUT))
   8.603 -  {
   8.604 -    //KdPrint((__DRIVER_NAME "     Cmd = %02x, Length = %d, DMA_BIDIRECTIONAL\n", Srb->Cdb[0], Srb->DataTransferLength));
   8.605 -    shadow->req.sc_data_direction = DMA_BIDIRECTIONAL;
   8.606 -  }
   8.607 -  else if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_IN))
   8.608 -  {
   8.609 -    //KdPrint((__DRIVER_NAME "     Cmd = %02x, Length = %d, DMA_FROM_DEVICE\n", Srb->Cdb[0], Srb->DataTransferLength));
   8.610 -    shadow->req.sc_data_direction = DMA_FROM_DEVICE;
   8.611 -  }
   8.612 -  else if (Srb->DataTransferLength && (Srb->SrbFlags & SRB_FLAGS_DATA_OUT))
   8.613 -  {
   8.614 -    //KdPrint((__DRIVER_NAME "     Cmd = %02x, Length = %d, DMA_TO_DEVICE\n", Srb->Cdb[0], Srb->DataTransferLength));
   8.615 -    shadow->req.sc_data_direction = DMA_TO_DEVICE;
   8.616 -  }
   8.617 -  else
   8.618 -  {
   8.619 -    //KdPrint((__DRIVER_NAME "     Cmd = %02x, Length = %d, DMA_NONE\n", Srb->Cdb[0], Srb->DataTransferLength));
   8.620 -    shadow->req.sc_data_direction = DMA_NONE;
   8.621 -  }
   8.622 -
   8.623 -  remaining = Srb->DataTransferLength;
   8.624 -  shadow->req.seg[0].offset = 0;
   8.625 -  shadow->req.seg[0].length = 0;
   8.626 -  shadow->req.nr_segments = 0;
   8.627 -
   8.628 -  for (ptr = Srb->DataBuffer, shadow->req.nr_segments = 0; remaining != 0; shadow->req.nr_segments++)
   8.629 -  {
   8.630 -    if (shadow->req.nr_segments >= VSCSIIF_SG_TABLESIZE)
   8.631 -    {
   8.632 -      KdPrint((__DRIVER_NAME "     too many segments (length = %d, remaining = %d)\n", Srb->DataTransferLength, remaining));
   8.633 -    }
   8.634 -    physical_address = MmGetPhysicalAddress(ptr);
   8.635 -    pfn = (ULONG)(physical_address.QuadPart >> PAGE_SHIFT);
   8.636 -    shadow->req.seg[shadow->req.nr_segments].gref = get_grant_from_freelist(xsdd);
   8.637 -    if (shadow->req.seg[shadow->req.nr_segments].gref == 0x0FFFFFFF)
   8.638 -    {
   8.639 -      return; /* better than crashing... */
   8.640 -    }
   8.641 -    xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, shadow->req.seg[shadow->req.nr_segments].gref, (ULONG)'SCSI');
   8.642 -    shadow->req.seg[shadow->req.nr_segments].offset = (USHORT)(physical_address.LowPart & (PAGE_SIZE - 1));
   8.643 -    shadow->req.seg[shadow->req.nr_segments].length = (USHORT)min(PAGE_SIZE - (ULONG)shadow->req.seg[shadow->req.nr_segments].offset, remaining);
   8.644 -    remaining -= (ULONG)shadow->req.seg[shadow->req.nr_segments].length;
   8.645 -    ptr += shadow->req.seg[shadow->req.nr_segments].length;
   8.646 -    //KdPrint((__DRIVER_NAME "     Page = %d, Offset = %d, Length = %d, Remaining = %d\n", shadow->req.nr_segments, shadow->req.seg[shadow->req.nr_segments].offset, shadow->req.seg[shadow->req.nr_segments].length, remaining));
   8.647 -  }
   8.648 -  *RING_GET_REQUEST(&xsdd->ring, xsdd->ring.req_prod_pvt) = shadow->req;
   8.649 -  xsdd->ring.req_prod_pvt++;
   8.650 -  RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xsdd->ring, notify);
   8.651 -  if (notify)
   8.652 -  {
   8.653 -    //KdPrint((__DRIVER_NAME "     Notifying %d\n", xsdd->event_channel));
   8.654 -    xsdd->vectors.EvtChn_Notify(xsdd->vectors.context, xsdd->event_channel);
   8.655 -  }
   8.656 -
   8.657 -  //FUNCTION_EXIT();
   8.658 -}
   8.659 -
   8.660 -static BOOLEAN
   8.661 -XenScsi_HwScsiStartIo(PVOID DeviceExtension, PSCSI_REQUEST_BLOCK Srb)
   8.662 -{
   8.663 -  PXENSCSI_DEVICE_DATA xsdd = DeviceExtension;
   8.664 -  scsi_dev_t *dev;
   8.665 -
   8.666 -  //FUNCTION_ENTER();
   8.667 -  
   8.668 -  XenScsi_CheckNewDevice(DeviceExtension);
   8.669 -
   8.670 -  if (xsdd->scsiport_paused)
   8.671 -  {
   8.672 -    KdPrint((__DRIVER_NAME "     Busy\n"));
   8.673 -    Srb->SrbStatus = SRB_STATUS_BUSY;
   8.674 -    ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.675 -    //FUNCTION_EXIT();
   8.676 -    return TRUE;
   8.677 -  }
   8.678 -
   8.679 -  for (dev = (scsi_dev_t *)xsdd->dev_list_head.Flink;
   8.680 -    dev != (scsi_dev_t *)&xsdd->dev_list_head;
   8.681 -    dev = (scsi_dev_t * )dev->entry.Flink)
   8.682 -  {
   8.683 -    if (dev->channel == Srb->PathId && dev->id == Srb->TargetId && dev->lun == Srb->Lun)
   8.684 -      break;
   8.685 -  }
   8.686 -  if (dev == (scsi_dev_t *)&xsdd->dev_list_head)
   8.687 -  {
   8.688 -    Srb->SrbStatus = SRB_STATUS_NO_DEVICE;
   8.689 -    ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.690 -    //KdPrint((__DRIVER_NAME "     Out of bounds\n"));
   8.691 -    ScsiPortNotification(NextRequest, DeviceExtension);
   8.692 -    //FUNCTION_EXIT();
   8.693 -    return TRUE;
   8.694 -  }
   8.695 -
   8.696 -  switch (Srb->Function)
   8.697 -  {
   8.698 -  case SRB_FUNCTION_EXECUTE_SCSI:
   8.699 -    switch (Srb->Cdb[0])
   8.700 -    {
   8.701 -    case 0x03: { /* REQUEST_SENSE*/
   8.702 -      /* but what about when we allow multiple requests per lu? */
   8.703 -      PXENSCSI_LU_DATA lud = ScsiPortGetLogicalUnit(DeviceExtension, Srb->PathId, Srb->TargetId, Srb->Lun);
   8.704 -      if (lud != NULL && lud->sense_len)
   8.705 -      {
   8.706 -        int i;
   8.707 -        KdPrint((__DRIVER_NAME "     Emulating REQUEST_SENSE (lu data = %p)\n", lud));
   8.708 -        memcpy(Srb->DataBuffer, lud->sense_buffer, min(lud->sense_len, Srb->DataTransferLength));
   8.709 -        if (lud->sense_len > Srb->DataTransferLength)
   8.710 -        {
   8.711 -          KdPrint((__DRIVER_NAME "     Sense overrun Srb->DataTransferLength = %d, lud->sense_len = %d\n", Srb->DataTransferLength, lud->sense_len));
   8.712 -          Srb->DataTransferLength = lud->sense_len;
   8.713 -          Srb->SrbStatus = SRB_STATUS_DATA_OVERRUN;
   8.714 -        }
   8.715 -        else
   8.716 -        {
   8.717 -          Srb->SrbStatus = SRB_STATUS_SUCCESS;
   8.718 -        }
   8.719 -        for (i = 0; i < min(lud->sense_len, 8); i++)
   8.720 -          KdPrint((__DRIVER_NAME "     sense %02x: %02x\n", i, (ULONG)((PUCHAR)lud->sense_buffer)[i]));
   8.721 -        lud->sense_len = 0;
   8.722 -        ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.723 -        ScsiPortNotification(NextRequest, DeviceExtension);
   8.724 -        break;
   8.725 -      }
   8.726 -      else
   8.727 -      {
   8.728 -        KdPrint((__DRIVER_NAME "     Issuing REQUEST_SENSE (lud = %p)\n", lud));
   8.729 -      }
   8.730 -      // fall through
   8.731 -    }
   8.732 -    default:
   8.733 -      XenScsi_PutSrbOnRing(xsdd, Srb);
   8.734 -      Srb->SrbStatus = SRB_STATUS_PENDING;
   8.735 -      break;
   8.736 -    }
   8.737 -    break;
   8.738 -  case SRB_FUNCTION_IO_CONTROL:
   8.739 -    KdPrint((__DRIVER_NAME "     SRB_FUNCTION_IO_CONTROL\n"));
   8.740 -    Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   8.741 -    ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.742 -    ScsiPortNotification(NextRequest, DeviceExtension);
   8.743 -    break;
   8.744 -  case SRB_FUNCTION_FLUSH:
   8.745 -    KdPrint((__DRIVER_NAME "     SRB_FUNCTION_FLUSH\n"));
   8.746 -    Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   8.747 -    ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.748 -    ScsiPortNotification(NextRequest, DeviceExtension);
   8.749 -    break;
   8.750 -  default:
   8.751 -    KdPrint((__DRIVER_NAME "     Unhandled Srb->Function = %08X\n", Srb->Function));
   8.752 -    Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   8.753 -    ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   8.754 -    ScsiPortNotification(NextRequest, DeviceExtension);
   8.755 -    break;
   8.756 -  }
   8.757 -
   8.758 -  //FUNCTION_EXIT();
   8.759 -  return TRUE;
   8.760 -}
   8.761 -
   8.762 -static BOOLEAN
   8.763 -XenScsi_HwScsiResetBus(PVOID DeviceExtension, ULONG PathId)
   8.764 -{
   8.765 -  UNREFERENCED_PARAMETER(DeviceExtension);
   8.766 -  UNREFERENCED_PARAMETER(PathId);
   8.767 -
   8.768 -
   8.769 -  FUNCTION_ENTER();
   8.770 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   8.771 -  ScsiPortNotification(NextRequest, DeviceExtension);
   8.772 -  FUNCTION_EXIT();
   8.773 -
   8.774 -  return TRUE;
   8.775 -}
   8.776 -
   8.777 -static SCSI_ADAPTER_CONTROL_STATUS
   8.778 -XenScsi_HwScsiAdapterControl(PVOID DeviceExtension, SCSI_ADAPTER_CONTROL_TYPE ControlType, PVOID Parameters)
   8.779 -{
   8.780 -  SCSI_ADAPTER_CONTROL_STATUS Status = ScsiAdapterControlSuccess;
   8.781 -  PSCSI_SUPPORTED_CONTROL_TYPE_LIST SupportedControlTypeList;
   8.782 -  //KIRQL OldIrql;
   8.783 -
   8.784 -  UNREFERENCED_PARAMETER(DeviceExtension);
   8.785 -
   8.786 -  FUNCTION_ENTER();
   8.787 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   8.788 -
   8.789 -  switch (ControlType)
   8.790 -  {
   8.791 -  case ScsiQuerySupportedControlTypes:
   8.792 -    SupportedControlTypeList = (PSCSI_SUPPORTED_CONTROL_TYPE_LIST)Parameters;
   8.793 -    KdPrint((__DRIVER_NAME "     ScsiQuerySupportedControlTypes (Max = %d)\n", SupportedControlTypeList->MaxControlType));
   8.794 -    SupportedControlTypeList->SupportedTypeList[ScsiQuerySupportedControlTypes] = TRUE;
   8.795 -    SupportedControlTypeList->SupportedTypeList[ScsiStopAdapter] = TRUE;
   8.796 -    SupportedControlTypeList->SupportedTypeList[ScsiRestartAdapter] = TRUE;
   8.797 -    break;
   8.798 -  case ScsiStopAdapter:
   8.799 -    KdPrint((__DRIVER_NAME "     ScsiStopAdapter\n"));
   8.800 -    break;
   8.801 -  case ScsiRestartAdapter:
   8.802 -    KdPrint((__DRIVER_NAME "     ScsiRestartAdapter\n"));
   8.803 -    break;
   8.804 -  case ScsiSetBootConfig:
   8.805 -    KdPrint((__DRIVER_NAME "     ScsiSetBootConfig\n"));
   8.806 -    break;
   8.807 -  case ScsiSetRunningConfig:
   8.808 -    KdPrint((__DRIVER_NAME "     ScsiSetRunningConfig\n"));
   8.809 -    break;
   8.810 -  default:
   8.811 -    KdPrint((__DRIVER_NAME "     UNKNOWN\n"));
   8.812 -    break;
   8.813 -  }
   8.814 -
   8.815 -  FUNCTION_EXIT();
   8.816 -
   8.817 -  return Status;
   8.818 -}
   8.819 -
   8.820 -NTSTATUS
   8.821 -DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegistryPath)
   8.822 -{
   8.823 -  ULONG Status;
   8.824 -  HW_INITIALIZATION_DATA HwInitializationData;
   8.825 -  PVOID driver_extension;
   8.826 -  PUCHAR ptr;
   8.827 -
   8.828 -  FUNCTION_ENTER();
   8.829 -
   8.830 -  KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   8.831 -
   8.832 -  IoAllocateDriverObjectExtension(DriverObject, UlongToPtr(XEN_INIT_DRIVER_EXTENSION_MAGIC), PAGE_SIZE, &driver_extension);
   8.833 -  ptr = driver_extension;
   8.834 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "ring-ref", NULL, NULL);
   8.835 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_IRQ, "event-channel", NULL, NULL);
   8.836 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, UlongToPtr((ULONG)'SCSI'), UlongToPtr(144), NULL);
   8.837 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT, NULL, NULL, NULL);
   8.838 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitialised);
   8.839 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);
   8.840 -  __ADD_XEN_INIT_UCHAR(&ptr, 20);
   8.841 -  __ADD_XEN_INIT_UCHAR(&ptr, 0);
   8.842 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT, NULL, NULL, NULL);
   8.843 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);
   8.844 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);
   8.845 -  __ADD_XEN_INIT_UCHAR(&ptr, 20);
   8.846 -  __ADD_XEN_INIT_UCHAR(&ptr, 0);
   8.847 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_SHUTDOWN, NULL, NULL, NULL);
   8.848 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosing);
   8.849 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosing);
   8.850 -  __ADD_XEN_INIT_UCHAR(&ptr, 50);
   8.851 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosed);
   8.852 -  __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateClosed);
   8.853 -  __ADD_XEN_INIT_UCHAR(&ptr, 50);
   8.854 -  //__ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitWait); //ialising);
   8.855 -  //__ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitWait);
   8.856 -  //__ADD_XEN_INIT_UCHAR(&ptr, 50);
   8.857 -  __ADD_XEN_INIT_UCHAR(&ptr, 0);
   8.858 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_END, NULL, NULL, NULL);
   8.859 -  /* RegistryPath == NULL when we are invoked as a crash dump driver */
   8.860 -  if (!RegistryPath)
   8.861 -  {
   8.862 -    dump_mode = TRUE;
   8.863 -  }
   8.864 -
   8.865 -  RtlZeroMemory(&HwInitializationData, sizeof(HW_INITIALIZATION_DATA));
   8.866 -
   8.867 -  HwInitializationData.HwInitializationDataSize = sizeof(HW_INITIALIZATION_DATA);
   8.868 -  HwInitializationData.AdapterInterfaceType = PNPBus;
   8.869 -  HwInitializationData.DeviceExtensionSize = sizeof(XENSCSI_DEVICE_DATA);
   8.870 -  HwInitializationData.SpecificLuExtensionSize = sizeof(XENSCSI_LU_DATA);
   8.871 -  HwInitializationData.SrbExtensionSize = 0;
   8.872 -  HwInitializationData.NumberOfAccessRanges = 1;
   8.873 -  HwInitializationData.MapBuffers = TRUE;
   8.874 -  HwInitializationData.NeedPhysicalAddresses = FALSE;
   8.875 -  HwInitializationData.TaggedQueuing = TRUE;
   8.876 -  HwInitializationData.AutoRequestSense = TRUE;
   8.877 -  HwInitializationData.MultipleRequestPerLu = TRUE;
   8.878 -
   8.879 -  HwInitializationData.HwInitialize = XenScsi_HwScsiInitialize;
   8.880 -  HwInitializationData.HwStartIo = XenScsi_HwScsiStartIo;
   8.881 -  HwInitializationData.HwInterrupt = XenScsi_HwScsiInterrupt;
   8.882 -  HwInitializationData.HwFindAdapter = XenScsi_HwScsiFindAdapter;
   8.883 -  HwInitializationData.HwResetBus = XenScsi_HwScsiResetBus;
   8.884 -  HwInitializationData.HwAdapterControl = XenScsi_HwScsiAdapterControl;
   8.885 -
   8.886 -  Status = ScsiPortInitialize(DriverObject, RegistryPath, &HwInitializationData, NULL);
   8.887 -  
   8.888 -  if(!NT_SUCCESS(Status))
   8.889 -  {
   8.890 -    KdPrint((__DRIVER_NAME " ScsiPortInitialize failed with status 0x%08x\n", Status));
   8.891 -  }
   8.892 -
   8.893 -  FUNCTION_EXIT();
   8.894 -
   8.895 -  return Status;
   8.896 -}
     9.1 --- a/xenscsi/xenscsi.h	Sat Jan 04 18:17:02 2014 +1100
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,118 +0,0 @@
     9.4 -#if !defined(_XENSCSI_H_)
     9.5 -#define _XENSCSI_H_
     9.6 -
     9.7 -#include <ntifs.h>
     9.8 -#include <ntddk.h>
     9.9 -#include <wdm.h>
    9.10 -#include <initguid.h>
    9.11 -#include <ntdddisk.h>
    9.12 -//#include <srb.h>
    9.13 -
    9.14 -#define NTSTRSAFE_LIB
    9.15 -#include <ntstrsafe.h>
    9.16 -
    9.17 -#define __DRIVER_NAME "XenSCSI"
    9.18 -
    9.19 -#include <xen_windows.h>
    9.20 -#include <memory.h>
    9.21 -#include <grant_table.h>
    9.22 -#include <event_channel.h>
    9.23 -#include <hvm/params.h>
    9.24 -#include <hvm/hvm_op.h>
    9.25 -#include <xen_public.h>
    9.26 -#include <io/ring.h>
    9.27 -#include <io/vscsiif.h>
    9.28 -
    9.29 -//#include <io/blkif.h>
    9.30 -//#include <storport.h>
    9.31 -#include <scsi.h>
    9.32 -//#include <ntddscsi.h>
    9.33 -//#include <ntdddisk.h>
    9.34 -#include <stdlib.h>
    9.35 -#include <io/xenbus.h>
    9.36 -#include <io/protocols.h>
    9.37 -
    9.38 -
    9.39 -typedef struct vscsiif_request vscsiif_request_t;
    9.40 -typedef struct vscsiif_response vscsiif_response_t;
    9.41 -
    9.42 -#define XENSCSI_POOL_TAG (ULONG) 'XSCS'
    9.43 -
    9.44 -#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
    9.45 -#define VSCSIIF_RING_SIZE __RING_SIZE((vscsiif_sring_t *)0, PAGE_SIZE)
    9.46 -
    9.47 -typedef struct {
    9.48 -  vscsiif_request_t req;
    9.49 -  PSCSI_REQUEST_BLOCK Srb;
    9.50 -} vscsiif_shadow_t;
    9.51 -
    9.52 -#define SHADOW_ENTRIES 32
    9.53 -#define MAX_GRANT_ENTRIES 512
    9.54 -
    9.55 -#define SCSI_DEV_NODEV ((ULONG)-1)
    9.56 -
    9.57 -typedef struct {
    9.58 -  LIST_ENTRY entry;
    9.59 -  ULONG dev_no; // SCSI_DEV_NODEV == end
    9.60 -  ULONG state;
    9.61 -  BOOLEAN validated;
    9.62 -  UCHAR host;
    9.63 -  UCHAR channel;
    9.64 -  UCHAR id;
    9.65 -  UCHAR lun;
    9.66 -} scsi_dev_t;
    9.67 -
    9.68 -#if 0
    9.69 -#define SCSI_STATE_ENUM_PENDING     0
    9.70 -#define SCSI_STATE_ENUM_IN_PROGRESS 1
    9.71 -#define SCSI_STATE_ENUM_COMPLETE    2
    9.72 -
    9.73 -#define XENSCSI_MAX_ENUM_TIME 5
    9.74 -#endif
    9.75 -
    9.76 -#define SHARED_PAUSED_SCSIPORT_UNPAUSED 0
    9.77 -#define SHARED_PAUSED_PASSIVE_PAUSED    1
    9.78 -#define SHARED_PAUSED_SCSIPORT_PAUSED   2
    9.79 -#define SHARED_PAUSED_PASSIVE_UNPAUSED  3
    9.80 -
    9.81 -struct
    9.82 -{
    9.83 -  vscsiif_shadow_t shadows[SHADOW_ENTRIES];
    9.84 -  USHORT shadow_free_list[SHADOW_ENTRIES];
    9.85 -  USHORT shadow_free;
    9.86 -
    9.87 -  grant_ref_t grant_free_list[MAX_GRANT_ENTRIES];
    9.88 -  USHORT grant_free;
    9.89 -  USHORT grant_entries;
    9.90 -
    9.91 -  evtchn_port_t event_channel;
    9.92 -
    9.93 -  vscsiif_front_ring_t ring;
    9.94 -  
    9.95 -  XENPCI_VECTORS vectors;
    9.96 -  
    9.97 -  LIST_ENTRY dev_list_head;
    9.98 -    
    9.99 -  //BOOLEAN pause_req;
   9.100 -  //BOOLEAN pause_ack;
   9.101 -  volatile LONG shared_paused;
   9.102 -  ULONG scsiport_paused; /* scsiport code has acknowledged pause */
   9.103 -  ULONG bus_changes[8];
   9.104 -} typedef XENSCSI_DEVICE_DATA, *PXENSCSI_DEVICE_DATA;
   9.105 -
   9.106 -struct {
   9.107 -  UCHAR sense_len;
   9.108 -  UCHAR sense_buffer[VSCSIIF_SENSE_BUFFERSIZE];
   9.109 -} typedef XENSCSI_LU_DATA, *PXENSCSI_LU_DATA;
   9.110 -
   9.111 -enum dma_data_direction {
   9.112 -        DMA_BIDIRECTIONAL = 0,
   9.113 -        DMA_TO_DEVICE = 1,
   9.114 -        DMA_FROM_DEVICE = 2,
   9.115 -        DMA_NONE = 3,
   9.116 -};
   9.117 -
   9.118 -VOID
   9.119 -XenScsi_FillInitCallbacks(PHW_INITIALIZATION_DATA HwInitializationData);
   9.120 -
   9.121 -#endif
    10.1 --- a/xenscsi/xenscsi.inx	Sat Jan 04 18:17:02 2014 +1100
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,61 +0,0 @@
    10.4 -[Version]
    10.5 -Signature="$WINDOWS NT$"
    10.6 -Class=SCSIAdapter
    10.7 -ClassGuid={4D36E97B-E325-11CE-BFC1-08002BE10318}
    10.8 -Provider=%XenGplPv%
    10.9 -CatalogFile="xenscsi.cat"
   10.10 -
   10.11 -[DestinationDirs]
   10.12 -DefaultDestDir = 12
   10.13 -
   10.14 -[ControlFlags]
   10.15 -ExcludeFromSelect=*
   10.16 -
   10.17 -[Manufacturer]
   10.18 -%XenGplPv%=XenGplPv,NT$ARCH$
   10.19 -
   10.20 -[XenGplPv.NT$ARCH$]
   10.21 -%XenScsi.DRVDESC%=XenScsi_Inst, XEN\VSCSI
   10.22 -
   10.23 -[XenScsi_Inst.NT]
   10.24 -CopyFiles=XenScsi.CopyFiles
   10.25 -
   10.26 -[XenScsi.CopyFiles]
   10.27 -xenscsi.sys
   10.28 -
   10.29 -[XenScsi_Inst.NT.Services]
   10.30 -AddService=XenScsi,2,XenScsi_Service, XenScsi_EventLog
   10.31 -
   10.32 -[XenScsi_Service]
   10.33 -DisplayName    = %XenScsi.SVCDESC%                            
   10.34 -ServiceType    = 1
   10.35 -StartType      = 0
   10.36 -ErrorControl   = 1
   10.37 -LoadOrderGroup = System Bus Extender
   10.38 -ServiceBinary  = %12%\xenscsi.sys                            
   10.39 -AddReg = XenScsi_Service_AddReg
   10.40 -
   10.41 -[XenScsi_Service_AddReg]
   10.42 -HKR,"Parameters\PnpInterface", "15", 0x00010001, 0x00000001
   10.43 -; hide Qemu SCSI in XenPCI
   10.44 -HKLM,"SYSTEM\CurrentControlSet\Services\XenPCI\Parameters", "hide_devices", 0x00010008, "VEN_1000&DEV_0012"
   10.45 -
   10.46 -[XenScsi_EventLog]
   10.47 -AddReg = XenScsi_EventLog_AddReg
   10.48 -
   10.49 -[XenScsi_EventLog_AddReg]
   10.50 -HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\XenScsi.sys"
   10.51 -HKR,,TypesSupported,0x00010001,7
   10.52 -
   10.53 -[SourceDisksFiles]
   10.54 -xenscsi.sys=1
   10.55 -
   10.56 -[SourceDisksNames]
   10.57 -1 = %DISK_NAME%
   10.58 -
   10.59 -[Strings]
   10.60 -XenGplPv = "Xen GPL PV Driver Developers"
   10.61 -XenScsi.SVCDESC = "Xen SCSI Driver"
   10.62 -XenScsi.DRVDESC = "Xen SCSI Driver"
   10.63 -DISK_NAME = "Xen SCSI Device Driver Install Disk"
   10.64 -FLG_ADDREG_TYPE_DWORD = 0x00010001
    11.1 --- a/xenscsi/xenscsi.rc	Sat Jan 04 18:17:02 2014 +1100
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,28 +0,0 @@
    11.4 -#include <windows.h>
    11.5 -#include <ntverp.h>
    11.6 -#include "gplpv_version.h"
    11.7 -
    11.8 -#define VER_FILETYPE                VFT_DRV
    11.9 -#define VER_FILESUBTYPE             VFT2_DRV_SYSTEM
   11.10 -#ifdef DEBUG
   11.11 -  #define VER_FILEDESCRIPTION_STR     "GPLPV XenSCSI Driver"
   11.12 -#else
   11.13 -  #define VER_FILEDESCRIPTION_STR     "GPLPV XenSCSI Driver (Checked Build)"
   11.14 -#endif
   11.15 -#define VER_INTERNALNAME_STR        "xenscsi.sys"
   11.16 -#define VER_ORIGINALFILENAME_STR    "xenscsi.sys"
   11.17 -
   11.18 -#undef VER_PRODUCTVERSION
   11.19 -#define VER_PRODUCTVERSION          VER_FILEVERSION
   11.20 -#undef VER_PRODUCTVERSION_STR
   11.21 -#define VER_PRODUCTVERSION_STR      VER_FILEVERSION_STR
   11.22 -#define VER_LEGALCOPYRIGHT_STR      "Copyright (C) 2009 James Harper" 
   11.23 -
   11.24 -#ifdef VER_COMPANYNAME_STR
   11.25 -#undef VER_COMPANYNAME_STR
   11.26 -#define VER_COMPANYNAME_STR         "James Harper"
   11.27 -#endif
   11.28 -#undef VER_PRODUCTNAME_STR
   11.29 -#define VER_PRODUCTNAME_STR         "PV Drivers for Windows"
   11.30 -
   11.31 -#include "common.ver"