win-pvdrivers

changeset 362:f7a5c1889c36

Trying to debug a boot hang
author James Harper <james.harper@bendigoit.com.au>
date Mon Jul 07 20:45:27 2008 +1000 (2008-07-07)
parents c50047d5950a
children 097ab7d19ea2
files xenpci/xenpci_pdo.c xenvbd/scsiport.c
line diff
     1.1 --- a/xenpci/xenpci_pdo.c	Fri Jul 04 21:57:54 2008 +1000
     1.2 +++ b/xenpci/xenpci_pdo.c	Mon Jul 07 20:45:27 2008 +1000
     1.3 @@ -741,7 +741,7 @@ XenPci_Pnp_StartDevice(PDEVICE_OBJECT de
     1.4      {
     1.5      case CmResourceTypeInterrupt:
     1.6        KdPrint((__DRIVER_NAME "     CmResourceTypeInterrupt\n"));
     1.7 -      KdPrint((__DRIVER_NAME "     irq_vector = %03x\n", prd->u.Interrupt.Vector));
     1.8 +      KdPrint((__DRIVER_NAME "     irq_vector = %02x\n", prd->u.Interrupt.Vector));
     1.9        KdPrint((__DRIVER_NAME "     irq_level = %d\n", prd->u.Interrupt.Level));
    1.10        xppdd->irq_vector = prd->u.Interrupt.Vector;
    1.11        xppdd->irq_level = (KIRQL)prd->u.Interrupt.Level;
     2.1 --- a/xenvbd/scsiport.c	Fri Jul 04 21:57:54 2008 +1000
     2.2 +++ b/xenvbd/scsiport.c	Mon Jul 07 20:45:27 2008 +1000
     2.3 @@ -94,6 +94,10 @@ XenVbd_PutRequest(PXENVBD_DEVICE_DATA xv
     2.4  {
     2.5    blkif_other_request_t *other_req;
     2.6  
     2.7 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_prod = %d\n", xvdd->ring.sring->rsp_prod));
     2.8 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_event = %d\n", xvdd->ring.sring->rsp_event));
     2.9 +  //KdPrint((__DRIVER_NAME "     ring.rsp_cons = %d\n", xvdd->ring.rsp_cons));
    2.10 +  //KdPrint((__DRIVER_NAME "     ring.req_prod_pvt = %d\n", xvdd->ring.req_prod_pvt));
    2.11    if (!xvdd->use_other)
    2.12    {
    2.13      *RING_GET_REQUEST(&xvdd->ring, xvdd->ring.req_prod_pvt) = *req;
    2.14 @@ -109,6 +113,10 @@ XenVbd_PutRequest(PXENVBD_DEVICE_DATA xv
    2.15      memcpy(other_req->seg, req->seg, sizeof(struct blkif_request_segment) * req->nr_segments);
    2.16    }
    2.17    xvdd->ring.req_prod_pvt++;
    2.18 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_prod = %d\n", xvdd->ring.sring->rsp_prod));
    2.19 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_event = %d\n", xvdd->ring.sring->rsp_event));
    2.20 +  //KdPrint((__DRIVER_NAME "     ring.rsp_cons = %d\n", xvdd->ring.rsp_cons));
    2.21 +  //KdPrint((__DRIVER_NAME "     ring.req_prod_pvt = %d\n", xvdd->ring.req_prod_pvt));
    2.22  }
    2.23  
    2.24  static ULONG
    2.25 @@ -129,7 +137,7 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
    2.26      switch(type)
    2.27      {
    2.28      case XEN_INIT_TYPE_RING: /* frontend ring */
    2.29 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_RING - %s = %p\n", setting, value));
    2.30 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_RING - %s = %p\n", setting, value));
    2.31        if (strcmp(setting, "ring-ref") == 0)
    2.32        {
    2.33          xvdd->sring = (blkif_sring_t *)value;
    2.34 @@ -141,7 +149,7 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
    2.35        break;
    2.36      case XEN_INIT_TYPE_EVENT_CHANNEL: /* frontend event channel */
    2.37      case XEN_INIT_TYPE_EVENT_CHANNEL_IRQ: /* frontend event channel */
    2.38 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_EVENT_CHANNEL - %s = %d\n", setting, PtrToUlong(value)));
    2.39 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_EVENT_CHANNEL - %s = %d\n", setting, PtrToUlong(value)));
    2.40        if (strcmp(setting, "event-channel") == 0)
    2.41        {
    2.42          xvdd->event_channel = PtrToUlong(value);
    2.43 @@ -149,7 +157,7 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
    2.44        break;
    2.45      case XEN_INIT_TYPE_READ_STRING_BACK:
    2.46      case XEN_INIT_TYPE_READ_STRING_FRONT:
    2.47 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
    2.48 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING - %s = %s\n", setting, value));
    2.49        if (strcmp(setting, "sectors") == 0)
    2.50          xvdd->total_sectors = atoi(value);
    2.51        else if (strcmp(setting, "sector-size") == 0)
    2.52 @@ -174,7 +182,7 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
    2.53        }
    2.54        break;
    2.55      case XEN_INIT_TYPE_VECTORS:
    2.56 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_VECTORS\n"));
    2.57 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_VECTORS\n"));
    2.58        if (((PXENPCI_VECTORS)value)->length != sizeof(XENPCI_VECTORS) ||
    2.59          ((PXENPCI_VECTORS)value)->magic != XEN_DATA_MAGIC)
    2.60        {
    2.61 @@ -187,17 +195,17 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
    2.62          memcpy(&xvdd->vectors, value, sizeof(XENPCI_VECTORS));
    2.63        break;
    2.64      case XEN_INIT_TYPE_GRANT_ENTRIES:
    2.65 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(setting)));
    2.66 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(setting)));
    2.67        xvdd->grant_entries = (USHORT)PtrToUlong(setting);
    2.68        memcpy(&xvdd->grant_free_list, value, sizeof(grant_ref_t) * xvdd->grant_entries);
    2.69        xvdd->grant_free = xvdd->grant_entries;
    2.70        break;
    2.71      case XEN_INIT_TYPE_STATE_PTR:
    2.72 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_DEVICE_STATE - %p\n", PtrToUlong(value)));
    2.73 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_DEVICE_STATE - %p\n", PtrToUlong(value)));
    2.74        xvdd->device_state = (PXENPCI_DEVICE_STATE)value;
    2.75        break;
    2.76      default:
    2.77 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_%d\n", type));
    2.78 +      //KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_%d\n", type));
    2.79        break;
    2.80      }
    2.81    }
    2.82 @@ -237,7 +245,7 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    2.83    PUCHAR ptr;
    2.84    int notify;
    2.85  
    2.86 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.87 +  //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    2.88  
    2.89    //ASSERT(!(srb_offset == 0 && xvdd->split_request_in_progress));
    2.90    block_count = (srb->Cdb[7] << 8) | srb->Cdb[8];
    2.91 @@ -287,7 +295,7 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    2.92    if (PtrToUlong(srb->DataBuffer) & 511) /* use SrbExtension intead of DataBuffer if DataBuffer is not aligned to sector size */
    2.93    {
    2.94      shadow->req.sector_number += srb_offset / 512; //xvdd->bytes_per_sector;
    2.95 -    KdPrint((__DRIVER_NAME "     Using unaligned buffer - DataBuffer = %p, SrbExtension = %p, total length = %d, offset = %d, length = %d, sector = %d\n", srb->DataBuffer, srb->SrbExtension, block_count * 512, shadow->offset, shadow->length, shadow->req.sector_number));
    2.96 +    //KdPrint((__DRIVER_NAME "     Using unaligned buffer - DataBuffer = %p, SrbExtension = %p, total length = %d, offset = %d, length = %d, sector = %d\n", srb->DataBuffer, srb->SrbExtension, block_count * 512, shadow->offset, shadow->length, shadow->req.sector_number));
    2.97      if (srb->Cdb[0] == SCSIOP_WRITE)
    2.98      {
    2.99        memcpy(ptr, ((PUCHAR)srb->DataBuffer) + srb_offset, shadow->length);
   2.100 @@ -297,7 +305,10 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
   2.101    {
   2.102      ptr = srb->DataBuffer;
   2.103    }
   2.104 -
   2.105 +  //KdPrint((__DRIVER_NAME "     sector_number = %d\n", (ULONG)shadow->req.sector_number));
   2.106 +  //KdPrint((__DRIVER_NAME "     handle = %d\n", shadow->req.handle));
   2.107 +  //KdPrint((__DRIVER_NAME "     operation = %d\n", shadow->req.operation));
   2.108 +    
   2.109    remaining = shadow->length;  
   2.110    while (remaining > 0)
   2.111    {
   2.112 @@ -313,19 +324,26 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
   2.113      shadow->req.seg[shadow->req.nr_segments].last_sect = (UCHAR)(((offset + length) >> 9) - 1);
   2.114      remaining -= length;
   2.115      ptr += length;
   2.116 +    //KdPrint((__DRIVER_NAME "     seg[%d].gref = %d\n", shadow->req.nr_segments, shadow->req.seg[shadow->req.nr_segments].gref));
   2.117 +    //KdPrint((__DRIVER_NAME "     seg[%d].first_sect = %d\n", shadow->req.nr_segments, shadow->req.seg[shadow->req.nr_segments].first_sect));
   2.118 +    //KdPrint((__DRIVER_NAME "     seg[%d].last_sect = %d\n", shadow->req.nr_segments, shadow->req.seg[shadow->req.nr_segments].last_sect));
   2.119      shadow->req.nr_segments++;
   2.120    }
   2.121 -    
   2.122 +  //KdPrint((__DRIVER_NAME "     nr_segments = %d\n", shadow->req.nr_segments));
   2.123 +
   2.124    XenVbd_PutRequest(xvdd, &shadow->req);
   2.125  
   2.126    RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&xvdd->ring, notify);
   2.127    if (notify)
   2.128 +  {
   2.129 +    //KdPrint((__DRIVER_NAME "     Notifying\n"));
   2.130      xvdd->vectors.EvtChn_Notify(xvdd->vectors.context, xvdd->event_channel);
   2.131 +  }
   2.132  
   2.133    if (xvdd->shadow_free && srb_offset == 0)
   2.134      ScsiPortNotification(NextLuRequest, xvdd, 0, 0, 0);
   2.135  
   2.136 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.137 +  //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.138  }
   2.139  
   2.140  #define RESUME_CHECK_TIMER_INTERVAL (100 * 1000)
   2.141 @@ -467,23 +485,23 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
   2.142  
   2.143    req = RING_GET_REQUEST(&xvdd->ring, xvdd->ring.req_prod_pvt);
   2.144    req->operation = 0xff;
   2.145 -  req->nr_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST;
   2.146 -  for (i = 0; i < req->nr_segments; i++)
   2.147 +  req->nr_segments = 0;
   2.148 +  for (i = 0; i < BLKIF_MAX_SEGMENTS_PER_REQUEST; i++)
   2.149    {
   2.150 -    req->seg[i].gref = 0xffffffff;
   2.151 -    req->seg[i].first_sect = 0xff;
   2.152 -    req->seg[i].last_sect = 0xff;
   2.153 +    req->seg[i].gref = 0; //0xffffffff;
   2.154 +    req->seg[i].first_sect = 0; //0xff;
   2.155 +    req->seg[i].last_sect = 0; //0xff;
   2.156    }
   2.157    xvdd->ring.req_prod_pvt++;
   2.158  
   2.159    req = RING_GET_REQUEST(&xvdd->ring, xvdd->ring.req_prod_pvt);
   2.160    req->operation = 0xff;
   2.161 -  req->nr_segments = BLKIF_MAX_SEGMENTS_PER_REQUEST;
   2.162 -  for (i = 0; i < req->nr_segments; i++)
   2.163 +  req->nr_segments = 0;
   2.164 +  for (i = 0; i < BLKIF_MAX_SEGMENTS_PER_REQUEST; i++)
   2.165    {
   2.166 -    req->seg[i].gref = 0xffffffff;
   2.167 -    req->seg[i].first_sect = 0xff;
   2.168 -    req->seg[i].last_sect = 0xff;
   2.169 +    req->seg[i].gref = 0; //0xffffffff;
   2.170 +    req->seg[i].first_sect = 0; //0xff;
   2.171 +    req->seg[i].last_sect = 0; //0xff;
   2.172    }
   2.173    xvdd->ring.req_prod_pvt++;
   2.174  
   2.175 @@ -666,6 +684,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
   2.176          ScsiPortNotification(NextRequest, DeviceExtension);
   2.177          break;
   2.178        case 2:
   2.179 +        //KdPrint((__DRIVER_NAME "     ring_detect_state = %d, operation = %x, id = %lx, status = %d\n", xvdd->ring_detect_state, rep->operation, rep->id, rep->status));
   2.180          shadow = &xvdd->shadows[rep->id];
   2.181          srb = shadow->srb;
   2.182          ASSERT(srb != NULL);
   2.183 @@ -737,6 +756,11 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
   2.184      }
   2.185    }
   2.186  
   2.187 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_prod = %d\n", xvdd->ring.sring->rsp_prod));
   2.188 +  //KdPrint((__DRIVER_NAME "     ring.sring->rsp_event = %d\n", xvdd->ring.sring->rsp_event));
   2.189 +  //KdPrint((__DRIVER_NAME "     ring.rsp_cons = %d\n", xvdd->ring.rsp_cons));
   2.190 +  //KdPrint((__DRIVER_NAME "     ring.req_prod_pvt = %d\n", xvdd->ring.req_prod_pvt));
   2.191 +
   2.192    //KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   2.193    
   2.194    return FALSE; /* we just don't know... */
   2.195 @@ -749,7 +773,7 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   2.196    PCDB cdb;
   2.197    PXENVBD_DEVICE_DATA xvdd = DeviceExtension;
   2.198  
   2.199 -//  KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
   2.200 +  //KdPrint((__DRIVER_NAME " --> HwScsiStartIo PathId = %d, TargetId = %d, Lun = %d\n", Srb->PathId, Srb->TargetId, Srb->Lun));
   2.201  
   2.202    // If we haven't enumerated all the devices yet then just defer the request
   2.203    if (xvdd->ring_detect_state < 2)
   2.204 @@ -833,7 +857,7 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   2.205              memset(&DataBuffer[4], ' ', 8);
   2.206              break;
   2.207            default:
   2.208 -            KdPrint((__DRIVER_NAME "     Unknown Page %02x requested\n", Srb->Cdb[2]));
   2.209 +            //KdPrint((__DRIVER_NAME "     Unknown Page %02x requested\n", Srb->Cdb[2]));
   2.210              Srb->SrbStatus = SRB_STATUS_ERROR;
   2.211              break;
   2.212            }
   2.213 @@ -880,14 +904,14 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   2.214              DataBuffer[11] = 0x38;
   2.215              break;
   2.216            default:
   2.217 -            KdPrint((__DRIVER_NAME "     Unknown Page %02x requested\n", Srb->Cdb[2]));
   2.218 +            //KdPrint((__DRIVER_NAME "     Unknown Page %02x requested\n", Srb->Cdb[2]));
   2.219              Srb->SrbStatus = SRB_STATUS_ERROR;
   2.220              break;
   2.221            }
   2.222          }
   2.223          break;
   2.224        default:
   2.225 -        KdPrint((__DRIVER_NAME "     Unknown DeviceType %02x requested\n", xvdd->device_type));
   2.226 +        //KdPrint((__DRIVER_NAME "     Unknown DeviceType %02x requested\n", xvdd->device_type));
   2.227          Srb->SrbStatus = SRB_STATUS_ERROR;
   2.228          break;
   2.229        }
   2.230 @@ -999,13 +1023,13 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   2.231        Srb->SrbStatus = SRB_STATUS_SUCCESS;
   2.232        break;
   2.233      default:
   2.234 -      KdPrint((__DRIVER_NAME "     Unhandled EXECUTE_SCSI Command = %02X\n", Srb->Cdb[0]));
   2.235 +      //KdPrint((__DRIVER_NAME "     Unhandled EXECUTE_SCSI Command = %02X\n", Srb->Cdb[0]));
   2.236        Srb->SrbStatus = SRB_STATUS_ERROR;
   2.237        break;
   2.238      }
   2.239      if (Srb->SrbStatus == SRB_STATUS_ERROR)
   2.240      {
   2.241 -      KdPrint((__DRIVER_NAME "     EXECUTE_SCSI Command = %02X returned error %02x\n", Srb->Cdb[0], xvdd->last_sense_key));
   2.242 +      //KdPrint((__DRIVER_NAME "     EXECUTE_SCSI Command = %02X returned error %02x\n", Srb->Cdb[0], xvdd->last_sense_key));
   2.243        if (xvdd->last_sense_key == SCSI_SENSE_NO_SENSE)
   2.244        {
   2.245          xvdd->last_sense_key = SCSI_SENSE_ILLEGAL_REQUEST;
   2.246 @@ -1025,19 +1049,19 @@ XenVbd_HwScsiStartIo(PVOID DeviceExtensi
   2.247      }
   2.248      break;
   2.249    case SRB_FUNCTION_IO_CONTROL:
   2.250 -    KdPrint((__DRIVER_NAME "     SRB_FUNCTION_IO_CONTROL\n"));
   2.251 +    //KdPrint((__DRIVER_NAME "     SRB_FUNCTION_IO_CONTROL\n"));
   2.252      Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   2.253      ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   2.254      ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
   2.255      break;
   2.256    case SRB_FUNCTION_FLUSH:
   2.257 -    KdPrint((__DRIVER_NAME "     SRB_FUNCTION_FLUSH\n"));
   2.258 +    //KdPrint((__DRIVER_NAME "     SRB_FUNCTION_FLUSH\n"));
   2.259      Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   2.260      ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   2.261      ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
   2.262      break;
   2.263    default:
   2.264 -    KdPrint((__DRIVER_NAME "     Unhandled Srb->Function = %08X\n", Srb->Function));
   2.265 +    //KdPrint((__DRIVER_NAME "     Unhandled Srb->Function = %08X\n", Srb->Function));
   2.266      Srb->SrbStatus = SRB_STATUS_INVALID_REQUEST;
   2.267      ScsiPortNotification(RequestComplete, DeviceExtension, Srb);
   2.268      ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);