win-pvdrivers

changeset 816:4d1539643494

Add some debug for dump mode buffer alignment
Remove old coinstaller stuff from inf file
Fix build errors under Win2K build environment
Check for non-zero LUN
author James Harper <james.harper@bendigoit.com.au>
date Sun Oct 10 10:29:29 2010 +1100 (2010-10-10)
parents 7dd147a81427
children 678c7d92321c
files xenvbd/xenvbd.c xenvbd/xenvbd.h xenvbd/xenvbd.inx
line diff
     1.1 --- a/xenvbd/xenvbd.c	Sat Oct 09 18:15:35 2010 +1100
     1.2 +++ b/xenvbd/xenvbd.c	Sun Oct 10 10:29:29 2010 +1100
     1.3 @@ -341,7 +341,8 @@ decode_cdb_is_read(PSCSI_REQUEST_BLOCK s
     1.4    }
     1.5  }
     1.6  
     1.7 -ULONG max_dump_mode_size = 0;
     1.8 +ULONG max_dump_mode_blocks = 0;
     1.9 +ULONG max_dump_mode_length = 0;
    1.10  
    1.11  static VOID
    1.12  XenVbd_PutSrbOnList(PXENVBD_DEVICE_DATA xvdd, PSCSI_REQUEST_BLOCK srb)
    1.13 @@ -439,6 +440,8 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
    1.14  
    1.15      if ((ULONG_PTR)srb->DataBuffer & 511)
    1.16      {
    1.17 +      if (dump_mode)
    1.18 +        KdPrint((__DRIVER_NAME "     unaligned dump mode buffer = %d bytes\n", block_count * 512));
    1.19        ASSERT(!dump_mode || block_count * 512 < BLKIF_MAX_SEGMENTS_PER_REQUEST_DUMP_MODE * PAGE_SIZE);
    1.20        xvdd->aligned_buffer_in_use = TRUE;
    1.21        ptr = xvdd->aligned_buffer;
    1.22 @@ -452,10 +455,15 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
    1.23        shadow->aligned_buffer_in_use = FALSE;
    1.24      }
    1.25  
    1.26 -    if (dump_mode && block_count > max_dump_mode_size)
    1.27 +    if (dump_mode && block_count > max_dump_mode_blocks)
    1.28      {
    1.29 -      max_dump_mode_size = block_count;
    1.30 -      KdPrint((__DRIVER_NAME "     max_dump_mode_size = %d\n", max_dump_mode_size));
    1.31 +      max_dump_mode_blocks = block_count;
    1.32 +      KdPrint((__DRIVER_NAME "     max_dump_mode_blocks = %d\n", max_dump_mode_blocks));
    1.33 +    }
    1.34 +    if (dump_mode && srb->DataTransferLength > max_dump_mode_length)
    1.35 +    {
    1.36 +      max_dump_mode_length = srb->DataTransferLength;
    1.37 +      KdPrint((__DRIVER_NAME "     max_dump_mode_length = %d\n", max_dump_mode_length));
    1.38      }
    1.39  
    1.40      //KdPrint((__DRIVER_NAME "     sector_number = %d, block_count = %d\n", (ULONG)shadow->req.sector_number, block_count));
    1.41 @@ -523,7 +531,6 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
    1.42        //KdPrint((__DRIVER_NAME "     Notifying\n"));
    1.43        xvdd->vectors.EvtChn_Notify(xvdd->vectors.context, xvdd->event_channel);
    1.44      }
    1.45 -
    1.46    }
    1.47    if (xvdd->shadow_free && !xvdd->aligned_buffer_in_use)
    1.48    {
    1.49 @@ -603,6 +610,8 @@ XenVbd_HwScsiFindAdapter(PVOID DeviceExt
    1.50      ConfigInfo->NumberOfPhysicalBreaks = BLKIF_MAX_SEGMENTS_PER_REQUEST_DUMP_MODE - 1;
    1.51      //ConfigInfo->ScatterGather = FALSE;
    1.52    }
    1.53 +  KdPrint((__DRIVER_NAME "     ConfigInfo->MaximumTransferLength = %d\n", ConfigInfo->MaximumTransferLength));
    1.54 +  KdPrint((__DRIVER_NAME "     ConfigInfo->NumberOfPhysicalBreaks = %d\n", ConfigInfo->NumberOfPhysicalBreaks));
    1.55    ConfigInfo->ScatterGather = FALSE;
    1.56    ConfigInfo->AlignmentMask = 0;
    1.57    ConfigInfo->NumberOfBuses = 1;
    1.58 @@ -1113,7 +1122,7 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
    1.59      return TRUE;
    1.60    }
    1.61  
    1.62 -  if (srb->PathId != 0 || srb->TargetId != 0)
    1.63 +  if (srb->PathId != 0 || srb->TargetId != 0 || srb->Lun != 0)
    1.64    {
    1.65      srb->SrbStatus = SRB_STATUS_NO_DEVICE;
    1.66      ScsiPortNotification(RequestComplete, DeviceExtension, srb);
    1.67 @@ -1684,6 +1693,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    1.68            wcstombs(scsi_cdrom_model, (PWCHAR)kpv->Data, min(kpv->DataLength, 16));
    1.69          else
    1.70            RtlStringCbCopyA(scsi_cdrom_model, 16, "PV CDROM        ");
    1.71 +        ZwClose(param_handle);
    1.72        }
    1.73        ZwClose(service_handle);
    1.74      }
     2.1 --- a/xenvbd/xenvbd.h	Sat Oct 09 18:15:35 2010 +1100
     2.2 +++ b/xenvbd/xenvbd.h	Sun Oct 10 10:29:29 2010 +1100
     2.3 @@ -30,6 +30,10 @@ Foundation, Inc., 51 Franklin Street, Fi
     2.4  #include <ntstrsafe.h>
     2.5  
     2.6  #include <ntdddisk.h>
     2.7 +#if (NTDDI_VERSION < NTDDI_WINXP) /* srb.h causes warnings under 2K for some reason */
     2.8 +#pragma warning(disable:4201) /* nameless struct/union */
     2.9 +#pragma warning(disable:4214) /* bit field types other than int */
    2.10 +#endif
    2.11  #include <srb.h>
    2.12  
    2.13  #define __DRIVER_NAME "XenVbd"
     3.1 --- a/xenvbd/xenvbd.inx	Sat Oct 09 18:15:35 2010 +1100
     3.2 +++ b/xenvbd/xenvbd.inx	Sun Oct 10 10:29:29 2010 +1100
     3.3 @@ -53,22 +53,8 @@ AddReg = XenVbd_EventLog_AddReg
     3.4  HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%SystemRoot%\System32\drivers\XenVbd.sys"
     3.5  HKR,,TypesSupported,0x00010001,7
     3.6  
     3.7 -;[DestinationDirs]
     3.8 -;XenVbd_Inst_CoInstaller_CopyFiles = 11
     3.9 -
    3.10 -;[XenVbd_Inst.NT.CoInstallers]
    3.11 -;AddReg=XenVbd_Inst_CoInstaller_AddReg
    3.12 -;CopyFiles=XenVbd_Inst_CoInstaller_CopyFiles
    3.13 -
    3.14 -;[XenVbd_Inst_CoInstaller_AddReg]
    3.15 -;HKR,,CoInstallers32,0x00010000, "xencoinst.dll,CoRequireReboot"
    3.16 -
    3.17 -;[XenVbd_Inst_CoInstaller_CopyFiles]
    3.18 -;xencoinst.dll
    3.19 -
    3.20  [SourceDisksFiles]
    3.21  xenvbd.sys=1
    3.22 -;xencoinst.dll=1
    3.23  
    3.24  [SourceDisksNames]
    3.25  1 = %DISK_NAME%