win-pvdrivers

changeset 359:8c419cbee528

Fixed a few warnings.
Fixed compile on win2k.
author James Harper <james.harper@bendigoit.com.au>
date Fri Jul 04 21:27:07 2008 +1000 (2008-07-04)
parents d2ebc66da34c
children cb12e8b450a8
files common.inc installer.nsi xenhide/xenhide.c xenpci/evtchn.c xenpci/xenpci_fdo.c xenpci/xenpci_pdo.c xenvbd/scsiport.c
line diff
     1.1 --- a/common.inc	Wed Jul 02 09:57:59 2008 +1000
     1.2 +++ b/common.inc	Fri Jul 04 21:27:07 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.10.4
     1.5 +VERSION=0.9.10.5
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/installer.nsi	Wed Jul 02 09:57:59 2008 +1000
     2.2 +++ b/installer.nsi	Fri Jul 04 21:27:07 2008 +1000
     2.3 @@ -3,7 +3,7 @@
     2.4  
     2.5  !define AppName "Xen PV Drivers"
     2.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     2.7 -!define Version "0.9.11-pre4"
     2.8 +!define Version "0.9.11-pre5"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
     3.1 --- a/xenhide/xenhide.c	Wed Jul 02 09:57:59 2008 +1000
     3.2 +++ b/xenhide/xenhide.c	Fri Jul 04 21:27:07 2008 +1000
     3.3 @@ -199,7 +199,7 @@ XenHide_IdSuffixMatches(PDEVICE_OBJECT p
     3.4        if (string_length >= wcslen(matching_id))
     3.5        {
     3.6          ptr += string_length - wcslen(matching_id);
     3.7 -        string_length -= wcslen(matching_id);
     3.8 +        string_length -= (ULONG)wcslen(matching_id);
     3.9        }
    3.10        //KdPrint((__DRIVER_NAME "     Comparing '%S' and '%S'\n", ptr, matching_id));
    3.11        if (wcscmp(ptr, matching_id) == 0)
     4.1 --- a/xenpci/evtchn.c	Wed Jul 02 09:57:59 2008 +1000
     4.2 +++ b/xenpci/evtchn.c	Fri Jul 04 21:27:07 2008 +1000
     4.3 @@ -366,7 +366,23 @@ EvtChn_Init(PXENPCI_DEVICE_DATA xpdd)
     4.4  NTSTATUS
     4.5  EvtChn_Shutdown(PXENPCI_DEVICE_DATA xpdd)
     4.6  {
     4.7 +#if (NTDDI_VERSION < NTDDI_WINXP)
     4.8 +  int i;
     4.9 +#endif
    4.10 +
    4.11    IoDisconnectInterrupt(xpdd->interrupt);
    4.12  
    4.13 +#if (NTDDI_VERSION >= NTDDI_WINXP)
    4.14 +  KeFlushQueuedDpcs();
    4.15 +#else
    4.16 +  for (i = 0; i < NR_EVENTS; i++)
    4.17 +  {
    4.18 +    if (xpdd->ev_actions[i].type == EVT_ACTION_TYPE_DPC || xpdd->ev_actions[i].type == EVT_ACTION_TYPE_IRQ)
    4.19 +    {
    4.20 +      KeRemoveQueueDpc(&xpdd->ev_actions[i].Dpc);
    4.21 +    }
    4.22 +  }
    4.23 +#endif
    4.24 +
    4.25    return STATUS_SUCCESS;
    4.26  }
     5.1 --- a/xenpci/xenpci_fdo.c	Wed Jul 02 09:57:59 2008 +1000
     5.2 +++ b/xenpci/xenpci_fdo.c	Fri Jul 04 21:27:07 2008 +1000
     5.3 @@ -449,7 +449,6 @@ XenPci_BeginSuspend(PXENPCI_DEVICE_DATA 
     5.4      }
     5.5      KeMemoryBarrier();
     5.6      EvtChn_Shutdown(xpdd);
     5.7 -    KeFlushQueuedDpcs();
     5.8  
     5.9      //ActiveProcessorCount = KeQueryActiveProcessorCount(&ActiveProcessorMask); // this is for Vista+
    5.10      ActiveProcessorCount = (ULONG)KeNumberProcessors;
     6.1 --- a/xenpci/xenpci_pdo.c	Wed Jul 02 09:57:59 2008 +1000
     6.2 +++ b/xenpci/xenpci_pdo.c	Fri Jul 04 21:27:07 2008 +1000
     6.3 @@ -461,6 +461,7 @@ XenPci_XenConfigDeviceSpecifyBuffers(PVO
     6.4    // first pass, possibly before state == Connected
     6.5    while((type = GET_XEN_INIT_REQ(&in_ptr, (PVOID)&setting, (PVOID)&value)) != XEN_INIT_TYPE_END)
     6.6    {
     6.7 +  
     6.8      if (!done_xenbus_init)
     6.9      {
    6.10        if (XenPci_ChangeFrontendState(xppdd, XenbusStateInitialising, XenbusStateInitWait, 30000) != STATUS_SUCCESS)
    6.11 @@ -498,7 +499,7 @@ XenPci_XenConfigDeviceSpecifyBuffers(PVO
    6.12            ADD_XEN_INIT_RSP(&xppdd->assigned_resources_ptr, type, setting, ring);
    6.13            // add the grant entry too so it gets freed automatically
    6.14            __ADD_XEN_INIT_UCHAR(&xppdd->assigned_resources_ptr, XEN_INIT_TYPE_GRANT_ENTRIES);
    6.15 -          __ADD_XEN_INIT_ULONG(&xppdd->assigned_resources_ptr, PtrToUlong(1));
    6.16 +          __ADD_XEN_INIT_ULONG(&xppdd->assigned_resources_ptr, 1);
    6.17            __ADD_XEN_INIT_ULONG(&xppdd->assigned_resources_ptr, gref);
    6.18          }
    6.19          else
     7.1 --- a/xenvbd/scsiport.c	Wed Jul 02 09:57:59 2008 +1000
     7.2 +++ b/xenvbd/scsiport.c	Fri Jul 04 21:27:07 2008 +1000
     7.3 @@ -325,7 +325,7 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
     7.4    if (xvdd->shadow_free && srb_offset == 0)
     7.5      ScsiPortNotification(NextLuRequest, xvdd, 0, 0, 0);
     7.6  
     7.7 -  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
     7.8 +//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
     7.9  }
    7.10  
    7.11  #define RESUME_CHECK_TIMER_INTERVAL (100 * 1000)
    7.12 @@ -339,14 +339,6 @@ XenVbd_HwScsiTimer(PVOID DeviceExtension
    7.13    ULONG shadow_entries;
    7.14    blkif_shadow_t *shadow;  
    7.15  
    7.16 -/*
    7.17 -  KdPrint((__DRIVER_NAME "     aligned requests   = %I64d, aligned bytes   = %I64d\n", xvdd->aligned_requests, xvdd->aligned_bytes));
    7.18 -  KdPrint((__DRIVER_NAME "     unaligned requests = %I64d, unaligned bytes = %I64d\n", xvdd->unaligned_requests, xvdd->unaligned_bytes));
    7.19 -  KdPrint((__DRIVER_NAME "     interrupts = %I64d\n", xvdd->interrupts));
    7.20 -  KdPrint((__DRIVER_NAME "     no_free_grant_requests = %I64d\n", xvdd->no_free_grant_requests));
    7.21 -  xvdd->shadow_min_free = xvdd->shadow_free;
    7.22 -*/
    7.23 -
    7.24    if (xvdd->device_state->resume_state == RESUME_STATE_FRONTEND_RESUME)
    7.25    {
    7.26      KdPrint((__DRIVER_NAME "     found device in resume state\n"));
    7.27 @@ -475,7 +467,7 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
    7.28  
    7.29    req = RING_GET_REQUEST(&xvdd->ring, xvdd->ring.req_prod_pvt);
    7.30    req->operation = 0xff;
    7.31 -  req->nr_segments = 0;
    7.32 +  req->nr_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST;
    7.33    for (i = 0; i < req->nr_segments; i++)
    7.34    {
    7.35      req->seg[i].gref = 0xffffffff;
    7.36 @@ -486,7 +478,7 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
    7.37  
    7.38    req = RING_GET_REQUEST(&xvdd->ring, xvdd->ring.req_prod_pvt);
    7.39    req->operation = 0xff;
    7.40 -  req->nr_segments = 0;
    7.41 +  req->nr_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST;
    7.42    for (i = 0; i < req->nr_segments; i++)
    7.43    {
    7.44      req->seg[i].gref = 0xffffffff;
    7.45 @@ -671,7 +663,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
    7.46            xvdd->use_other = TRUE;
    7.47          }
    7.48          xvdd->ring_detect_state = 2;
    7.49 -        ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
    7.50 +        ScsiPortNotification(NextRequest, DeviceExtension);
    7.51          break;
    7.52        case 2:
    7.53          shadow = &xvdd->shadows[rep->id];
    7.54 @@ -757,7 +749,7 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
    7.55    PCDB cdb;
    7.56    PXENVBD_DEVICE_DATA xvdd = DeviceExtension;
    7.57  
    7.58 -  //KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
    7.59 +//  KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
    7.60  
    7.61    // If we haven't enumerated all the devices yet then just defer the request
    7.62    if (xvdd->ring_detect_state < 2)
    7.63 @@ -799,10 +791,10 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
    7.64        Srb->ScsiStatus = 0;
    7.65        break;
    7.66      case SCSIOP_INQUIRY:
    7.67 -      KdPrint((__DRIVER_NAME "     Command = INQUIRY\n"));
    7.68 -      KdPrint((__DRIVER_NAME "     (LUN = %d, EVPD = %d, Page Code = %02X)\n", Srb->Cdb[1] >> 5, Srb->Cdb[1] & 1, Srb->Cdb[2]));
    7.69 -      KdPrint((__DRIVER_NAME "     (Length = %d)\n", Srb->DataTransferLength));
    7.70 -      KdPrint((__DRIVER_NAME "     (Srb->Databuffer = %08x)\n", Srb->DataBuffer));
    7.71 +//      KdPrint((__DRIVER_NAME "     Command = INQUIRY\n"));
    7.72 +//      KdPrint((__DRIVER_NAME "     (LUN = %d, EVPD = %d, Page Code = %02X)\n", Srb->Cdb[1] >> 5, Srb->Cdb[1] & 1, Srb->Cdb[2]));
    7.73 +//      KdPrint((__DRIVER_NAME "     (Length = %d)\n", Srb->DataTransferLength));
    7.74 +//      KdPrint((__DRIVER_NAME "     (Srb->Databuffer = %08x)\n", Srb->DataBuffer));
    7.75        DataBuffer = Srb->DataBuffer;
    7.76        RtlZeroMemory(DataBuffer, Srb->DataTransferLength);
    7.77        Srb->SrbStatus = SRB_STATUS_SUCCESS;
    7.78 @@ -929,25 +921,25 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
    7.79        Srb->SrbStatus = SRB_STATUS_SUCCESS;
    7.80        break;
    7.81      case SCSIOP_MODE_SENSE:
    7.82 -      KdPrint((__DRIVER_NAME "     Command = MODE_SENSE (DBD = %d, PC = %d, Page Code = %02x)\n", Srb->Cdb[1] & 0x08, Srb->Cdb[2] & 0xC0, Srb->Cdb[2] & 0x3F));
    7.83 +//      KdPrint((__DRIVER_NAME "     Command = MODE_SENSE (DBD = %d, PC = %d, Page Code = %02x)\n", Srb->Cdb[1] & 0x08, Srb->Cdb[2] & 0xC0, Srb->Cdb[2] & 0x3F));
    7.84        XenVbd_FillModePage(xvdd, Srb);
    7.85        break;
    7.86      case SCSIOP_WRITE:
    7.87      case SCSIOP_READ:
    7.88 -      //KdPrint((__DRIVER_NAME "     Command = READ/WRITE\n"));
    7.89 +//      KdPrint((__DRIVER_NAME "     Command = READ/WRITE\n"));
    7.90        XenVbd_PutSrbOnRing(xvdd, Srb, 0);
    7.91        break;
    7.92      case SCSIOP_VERIFY:
    7.93        // Should we do more here?
    7.94 -      KdPrint((__DRIVER_NAME "     Command = VERIFY\n"));
    7.95 +//      KdPrint((__DRIVER_NAME "     Command = VERIFY\n"));
    7.96        Srb->SrbStatus = SRB_STATUS_SUCCESS;
    7.97        break;
    7.98      case SCSIOP_REPORT_LUNS:
    7.99 -      KdPrint((__DRIVER_NAME "     Command = REPORT_LUNS\n"));
   7.100 +//      KdPrint((__DRIVER_NAME "     Command = REPORT_LUNS\n"));
   7.101        Srb->SrbStatus = SRB_STATUS_SUCCESS;;
   7.102        break;
   7.103      case SCSIOP_REQUEST_SENSE:
   7.104 -      KdPrint((__DRIVER_NAME "     Command = REQUEST_SENSE\n"));
   7.105 +//      KdPrint((__DRIVER_NAME "     Command = REQUEST_SENSE\n"));
   7.106        XenVbd_MakeSense(xvdd, Srb, xvdd->last_sense_key, xvdd->last_additional_sense_code);
   7.107        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   7.108        break;      
   7.109 @@ -961,14 +953,14 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   7.110  #define READ_TOC_FORMAT_PMA         0x03
   7.111  #define READ_TOC_FORMAT_ATIP        0x04
   7.112  */
   7.113 -      KdPrint((__DRIVER_NAME "     Command = READ_TOC\n"));
   7.114 -      KdPrint((__DRIVER_NAME "     Msf = %d\n", cdb->READ_TOC.Msf));
   7.115 -      KdPrint((__DRIVER_NAME "     LogicalUnitNumber = %d\n", cdb->READ_TOC.LogicalUnitNumber));
   7.116 -      KdPrint((__DRIVER_NAME "     Format2 = %d\n", cdb->READ_TOC.Format2));
   7.117 -      KdPrint((__DRIVER_NAME "     StartingTrack = %d\n", cdb->READ_TOC.StartingTrack));
   7.118 -      KdPrint((__DRIVER_NAME "     AllocationLength = %d\n", (cdb->READ_TOC.AllocationLength[0] << 8) | cdb->READ_TOC.AllocationLength[1]));
   7.119 -      KdPrint((__DRIVER_NAME "     Control = %d\n", cdb->READ_TOC.Control));
   7.120 -      KdPrint((__DRIVER_NAME "     Format = %d\n", cdb->READ_TOC.Format));
   7.121 +//      KdPrint((__DRIVER_NAME "     Command = READ_TOC\n"));
   7.122 +//      KdPrint((__DRIVER_NAME "     Msf = %d\n", cdb->READ_TOC.Msf));
   7.123 +//      KdPrint((__DRIVER_NAME "     LogicalUnitNumber = %d\n", cdb->READ_TOC.LogicalUnitNumber));
   7.124 +//      KdPrint((__DRIVER_NAME "     Format2 = %d\n", cdb->READ_TOC.Format2));
   7.125 +//      KdPrint((__DRIVER_NAME "     StartingTrack = %d\n", cdb->READ_TOC.StartingTrack));
   7.126 +//      KdPrint((__DRIVER_NAME "     AllocationLength = %d\n", (cdb->READ_TOC.AllocationLength[0] << 8) | cdb->READ_TOC.AllocationLength[1]));
   7.127 +//      KdPrint((__DRIVER_NAME "     Control = %d\n", cdb->READ_TOC.Control));
   7.128 +//      KdPrint((__DRIVER_NAME "     Format = %d\n", cdb->READ_TOC.Format));
   7.129        switch (cdb->READ_TOC.Format2)
   7.130        {
   7.131        case READ_TOC_FORMAT_TOC:
   7.132 @@ -995,15 +987,15 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   7.133        }
   7.134        break;
   7.135      case SCSIOP_START_STOP_UNIT:
   7.136 -      KdPrint((__DRIVER_NAME "     Command = SCSIOP_START_STOP_UNIT\n"));
   7.137 +//      KdPrint((__DRIVER_NAME "     Command = SCSIOP_START_STOP_UNIT\n"));
   7.138        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   7.139        break;
   7.140      case SCSIOP_RESERVE_UNIT:
   7.141 -      KdPrint((__DRIVER_NAME "     Command = SCSIOP_RESERVE_UNIT\n"));
   7.142 +//      KdPrint((__DRIVER_NAME "     Command = SCSIOP_RESERVE_UNIT\n"));
   7.143        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   7.144        break;
   7.145      case SCSIOP_RELEASE_UNIT:
   7.146 -      KdPrint((__DRIVER_NAME "     Command = SCSIOP_RELEASE_UNIT\n"));
   7.147 +//      KdPrint((__DRIVER_NAME "     Command = SCSIOP_RELEASE_UNIT\n"));
   7.148        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   7.149        break;
   7.150      default:
   7.151 @@ -1063,10 +1055,13 @@ XenVbd_HwScsiResetBus(PVOID DeviceExtens
   7.152    UNREFERENCED_PARAMETER(PathId);
   7.153  
   7.154    KdPrint((__DRIVER_NAME " --> HwScsiResetBus\n"));
   7.155 +
   7.156    KdPrint((__DRIVER_NAME "     IRQL = %d\n", KeGetCurrentIrql()));
   7.157 +  ScsiPortNotification(NextRequest, DeviceExtension);
   7.158  
   7.159    KdPrint((__DRIVER_NAME " <-- HwScsiResetBus\n"));
   7.160  
   7.161 +
   7.162    return TRUE;
   7.163  }
   7.164