win-pvdrivers

changeset 846:1b1fde762e0c 0.11.0.265

Fix a bug in scsiport crash dump / hibernate
author James Harper <james.harper@bendigoit.com.au>
date Wed Feb 09 13:33:45 2011 +1100 (2011-02-09)
parents 2e68b52de2ef
children 91b96d862346
files common/include/xen_windows.h xenscsi/xenscsi.c xenvbd/xenvbd_scsiport.c
line diff
     1.1 --- a/common/include/xen_windows.h	Sun Feb 06 14:32:13 2011 +1100
     1.2 +++ b/common/include/xen_windows.h	Wed Feb 09 13:33:45 2011 +1100
     1.3 @@ -602,8 +602,8 @@ ADD_XEN_INIT_RSP(PUCHAR *ptr, UCHAR type
     1.4    case XEN_INIT_TYPE_GRANT_ENTRIES:
     1.5      __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p1));
     1.6      __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
     1.7 -    memcpy(*ptr, p2, PtrToUlong(p1) * sizeof(grant_entry_t));
     1.8 -    *ptr += PtrToUlong(p1) * sizeof(grant_entry_t);
     1.9 +    memcpy(*ptr, p3, PtrToUlong(p2) * sizeof(grant_entry_t));
    1.10 +    *ptr += PtrToUlong(p2) * sizeof(grant_entry_t);
    1.11      break;
    1.12    case XEN_INIT_TYPE_QEMU_HIDE_FLAGS:
    1.13      __ADD_XEN_INIT_ULONG(ptr, PtrToUlong(p2));
     2.1 --- a/xenscsi/xenscsi.c	Sun Feb 06 14:32:13 2011 +1100
     2.2 +++ b/xenscsi/xenscsi.c	Wed Feb 09 13:33:45 2011 +1100
     2.3 @@ -192,7 +192,7 @@ XenScsi_HwScsiInterrupt(PVOID DeviceExte
     2.4        //remaining = Srb->DataTransferLength;
     2.5        for (j = 0; j < shadow->req.nr_segments; j++)
     2.6        {
     2.7 -        xsdd->vectors.GntTbl_EndAccess(xsdd->vectors.context, shadow->req.seg[j].gref, TRUE, (ULONG)'XPDO');
     2.8 +        xsdd->vectors.GntTbl_EndAccess(xsdd->vectors.context, shadow->req.seg[j].gref, TRUE, (ULONG)'SCSI');
     2.9          put_grant_on_freelist(xsdd, shadow->req.seg[j].gref);
    2.10          shadow->req.seg[j].gref = 0;
    2.11        }
    2.12 @@ -494,9 +494,9 @@ XenScsi_HwScsiFindAdapter(PVOID DeviceEx
    2.13          memcpy(&xsdd->vectors, value, sizeof(XENPCI_VECTORS));
    2.14        break;
    2.15      case XEN_INIT_TYPE_GRANT_ENTRIES:
    2.16 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(setting)));
    2.17 -      xsdd->grant_entries = (USHORT)PtrToUlong(setting);
    2.18 -      memcpy(&xsdd->grant_free_list, value, sizeof(grant_ref_t) * xsdd->grant_entries);
    2.19 +      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(value)));
    2.20 +      xsdd->grant_entries = (USHORT)PtrToUlong(value);
    2.21 +      memcpy(&xsdd->grant_free_list, value2, sizeof(grant_ref_t) * xsdd->grant_entries);
    2.22        xsdd->grant_free = xsdd->grant_entries;
    2.23        break;
    2.24      default:
    2.25 @@ -635,7 +635,7 @@ XenScsi_PutSrbOnRing(PXENSCSI_DEVICE_DAT
    2.26      {
    2.27        return; /* better than crashing... */
    2.28      }
    2.29 -    xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, 0, shadow->req.seg[shadow->req.nr_segments].gref, (ULONG)'XPDO');
    2.30 +    xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, 0, shadow->req.seg[shadow->req.nr_segments].gref, (ULONG)'SCSI');
    2.31      shadow->req.seg[shadow->req.nr_segments].offset = (USHORT)(physical_address.LowPart & (PAGE_SIZE - 1));
    2.32      shadow->req.seg[shadow->req.nr_segments].length = (USHORT)min(PAGE_SIZE - (ULONG)shadow->req.seg[shadow->req.nr_segments].offset, remaining);
    2.33      remaining -= (ULONG)shadow->req.seg[shadow->req.nr_segments].length;
    2.34 @@ -828,7 +828,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    2.35    ptr = driver_extension;
    2.36    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "ring-ref", NULL, NULL);
    2.37    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_IRQ, "event-channel", NULL, NULL);
    2.38 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, NULL, UlongToPtr(144), NULL);
    2.39 +  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, UlongToPtr((ULONG)'SCSI'), UlongToPtr(144), NULL);
    2.40    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT, NULL, NULL, NULL);
    2.41    __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateInitialised);
    2.42    __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);
     3.1 --- a/xenvbd/xenvbd_scsiport.c	Sun Feb 06 14:32:13 2011 +1100
     3.2 +++ b/xenvbd/xenvbd_scsiport.c	Wed Feb 09 13:33:45 2011 +1100
     3.3 @@ -227,8 +227,8 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
     3.4        qemu_protocol_version = PtrToUlong(value);
     3.5        break;
     3.6      case XEN_INIT_TYPE_GRANT_ENTRIES:
     3.7 -      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - entries = %d\n", PtrToUlong(setting)));
     3.8 -      memcpy(xvdd->dump_grant_refs, value, PtrToUlong(setting) * sizeof(grant_ref_t));
     3.9 +      KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - entries = %d\n", PtrToUlong(value)));
    3.10 +      memcpy(xvdd->dump_grant_refs, value2, PtrToUlong(value) * sizeof(grant_ref_t));
    3.11        break;
    3.12      case XEN_INIT_TYPE_QEMU_HIDE_FLAGS:
    3.13        qemu_hide_flags_value = PtrToUlong(value);
    3.14 @@ -479,12 +479,12 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
    3.15        {
    3.16          gref = xvdd->vectors.GntTbl_GrantAccess(xvdd->vectors.context, 0,
    3.17                   (ULONG)(physical_address.QuadPart >> PAGE_SHIFT), FALSE,
    3.18 -                 xvdd->dump_grant_refs[shadow->req.nr_segments], (ULONG)'XPDO');
    3.19 +                 xvdd->dump_grant_refs[shadow->req.nr_segments], (ULONG)'SCSI');
    3.20        }
    3.21        else
    3.22        {
    3.23          gref = xvdd->vectors.GntTbl_GrantAccess(xvdd->vectors.context, 0,
    3.24 -                 (ULONG)(physical_address.QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF, (ULONG)'XVBD');
    3.25 +                 (ULONG)(physical_address.QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF, (ULONG)'SCSI');
    3.26        }
    3.27        if (gref == INVALID_GRANT_REF)
    3.28        {
    3.29 @@ -492,7 +492,7 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
    3.30          for (i = 0; i < shadow->req.nr_segments; i++)
    3.31          {
    3.32            xvdd->vectors.GntTbl_EndAccess(xvdd->vectors.context,
    3.33 -            shadow->req.seg[i].gref, FALSE, (ULONG)'XVBD');
    3.34 +            shadow->req.seg[i].gref, FALSE, (ULONG)'SCSI');
    3.35          }
    3.36          if (shadow->aligned_buffer_in_use)
    3.37          {
    3.38 @@ -1038,12 +1038,12 @@ KdPrint((__DRIVER_NAME "     Completed r
    3.39            if (dump_mode)
    3.40            {
    3.41              xvdd->vectors.GntTbl_EndAccess(xvdd->vectors.context,
    3.42 -              shadow->req.seg[j].gref, TRUE, (ULONG)'XPDO');
    3.43 +              shadow->req.seg[j].gref, TRUE, (ULONG)'SCSI');
    3.44            }
    3.45            else
    3.46            {
    3.47              xvdd->vectors.GntTbl_EndAccess(xvdd->vectors.context,
    3.48 -              shadow->req.seg[j].gref, FALSE, (ULONG)'XVBD');
    3.49 +              shadow->req.seg[j].gref, FALSE, (ULONG)'SCSI');
    3.50            }
    3.51          }
    3.52          shadow->aligned_buffer_in_use = FALSE;
    3.53 @@ -1624,7 +1624,7 @@ DriverEntry(PDRIVER_OBJECT DriverObject,
    3.54      ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "mode", NULL, NULL);
    3.55      ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "sectors", NULL, NULL);
    3.56      ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_BACK, "sector-size", NULL, NULL);
    3.57 -    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, NULL, ULongToPtr(BLKIF_MAX_SEGMENTS_PER_REQUEST), NULL); /* for use in crash dump */
    3.58 +    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_GRANT_ENTRIES, ULongToPtr((ULONG)'SCSI'), ULongToPtr(BLKIF_MAX_SEGMENTS_PER_REQUEST), NULL); /* for use in crash dump */
    3.59      ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT, NULL, NULL, NULL);
    3.60      __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);
    3.61      __ADD_XEN_INIT_UCHAR(&ptr, XenbusStateConnected);