win-pvdrivers

changeset 976:941699790045 0.11.0.358

Handle backend-id purely in xenpci_pdo. Remove domid parameter from fdo calls.
author James Harper <james.harper@bendigoit.com.au>
date Sun Apr 15 15:34:10 2012 +1000 (2012-04-15)
parents 3560901bfe11
children b9ca617869d9
files common/include/xen_windows.h xennet/xennet5_rx.c xennet/xennet5_tx.c xennet/xennet6_rx.c xennet/xennet6_tx.c xenpci/xenpci_pdo.c xenscsi/xenscsi.c xenusb/xenusb_fdo.c xenvbd/xenvbd_storport.c
line diff
     1.1 --- a/common/include/xen_windows.h	Sun Apr 15 15:13:54 2012 +1000
     1.2 +++ b/common/include/xen_windows.h	Sun Apr 15 15:34:10 2012 +1000
     1.3 @@ -250,7 +250,7 @@ typedef BOOLEAN
     1.4  (*PXEN_EVTCHN_SYNC)(PVOID Context, PXEN_EVTCHN_SYNC_ROUTINE sync_routine, PVOID sync_context);
     1.5  
     1.6  typedef grant_ref_t
     1.7 -(*PXEN_GNTTBL_GRANTACCESS)(PVOID Context, domid_t domid, uint32_t frame, int readonly, grant_ref_t ref, ULONG tag);
     1.8 +(*PXEN_GNTTBL_GRANTACCESS)(PVOID Context, uint32_t frame, int readonly, grant_ref_t ref, ULONG tag);
     1.9  
    1.10  typedef BOOLEAN
    1.11  (*PXEN_GNTTBL_ENDACCESS)(PVOID Context, grant_ref_t ref, BOOLEAN keepref, ULONG tag);
    1.12 @@ -305,7 +305,7 @@ XenPci_FreeMem(PVOID Ptr)
    1.13    ExFreePoolWithTag(Ptr, XENPCI_POOL_TAG);
    1.14  }
    1.15  
    1.16 -#define XEN_DATA_MAGIC 0x12345679
    1.17 +#define XEN_DATA_MAGIC (ULONG)'XV02'
    1.18  
    1.19  typedef struct {
    1.20    ULONG magic;
     2.1 --- a/xennet/xennet5_rx.c	Sun Apr 15 15:13:54 2012 +1000
     2.2 +++ b/xennet/xennet5_rx.c	Sun Apr 15 15:34:10 2012 +1000
     2.3 @@ -50,7 +50,7 @@ get_pb_from_freelist(struct xennet_info 
     2.4      NdisFreeMemory(pb, sizeof(shared_buffer_t), 0);
     2.5      return NULL;
     2.6    }
     2.7 -  pb->gref = (grant_ref_t)xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0,
     2.8 +  pb->gref = (grant_ref_t)xi->vectors.GntTbl_GrantAccess(xi->vectors.context,
     2.9              (ULONG)(MmGetPhysicalAddress(pb->virtual).QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF, (ULONG)'XNRX');
    2.10    if (pb->gref == INVALID_GRANT_REF)
    2.11    {
     3.1 --- a/xennet/xennet5_tx.c	Sun Apr 15 15:13:54 2012 +1000
     3.2 +++ b/xennet/xennet5_tx.c	Sun Apr 15 15:34:10 2012 +1000
     3.3 @@ -49,7 +49,7 @@ XenNet_PutCbOnRing(struct xennet_info *x
     3.4    ASSERT(xi->tx_shadows[tx->id].gref == INVALID_GRANT_REF);
     3.5    ASSERT(!xi->tx_shadows[tx->id].cb);
     3.6    xi->tx_shadows[tx->id].cb = coalesce_buf;
     3.7 -  tx->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0, (ULONG)(MmGetPhysicalAddress(coalesce_buf).QuadPart >> PAGE_SHIFT), FALSE, gref, (ULONG)'XNTX');
     3.8 +  tx->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, (ULONG)(MmGetPhysicalAddress(coalesce_buf).QuadPart >> PAGE_SHIFT), FALSE, gref, (ULONG)'XNTX');
     3.9    xi->tx_shadows[tx->id].gref = tx->gref;
    3.10    tx->offset = 0;
    3.11    tx->size = (USHORT)length;
    3.12 @@ -342,7 +342,7 @@ XenNet_HWSendPacket(struct xennet_info *
    3.13        offset = MmGetMdlByteOffset(pi.curr_buffer) + pi.curr_mdl_offset;
    3.14        pfn = MmGetMdlPfnArray(pi.curr_buffer)[offset >> PAGE_SHIFT];
    3.15        txN->offset = (USHORT)offset & (PAGE_SIZE - 1);
    3.16 -      txN->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0, (ULONG)pfn, FALSE, gref, (ULONG)'XNTX');
    3.17 +      txN->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, (ULONG)pfn, FALSE, gref, (ULONG)'XNTX');
    3.18        ASSERT(xi->tx_shadows[txN->id].gref == INVALID_GRANT_REF);
    3.19        xi->tx_shadows[txN->id].gref = txN->gref;
    3.20        //ASSERT(sg->Elements[sg_element].Length > sg_offset);
     4.1 --- a/xennet/xennet6_rx.c	Sun Apr 15 15:13:54 2012 +1000
     4.2 +++ b/xennet/xennet6_rx.c	Sun Apr 15 15:34:10 2012 +1000
     4.3 @@ -54,7 +54,7 @@ get_pb_from_freelist(struct xennet_info 
     4.4      NdisFreeMemory(pb, sizeof(shared_buffer_t), 0);
     4.5      return NULL;
     4.6    }
     4.7 -  pb->gref = (grant_ref_t)xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0,
     4.8 +  pb->gref = (grant_ref_t)xi->vectors.GntTbl_GrantAccess(xi->vectors.context,
     4.9              (ULONG)(MmGetPhysicalAddress(pb->virtual).QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF, (ULONG)'XNRX');
    4.10    if (pb->gref == INVALID_GRANT_REF)
    4.11    {
     5.1 --- a/xennet/xennet6_tx.c	Sun Apr 15 15:13:54 2012 +1000
     5.2 +++ b/xennet/xennet6_tx.c	Sun Apr 15 15:34:10 2012 +1000
     5.3 @@ -49,7 +49,7 @@ XenNet_PutCbOnRing(struct xennet_info *x
     5.4    ASSERT(xi->tx_shadows[tx->id].gref == INVALID_GRANT_REF);
     5.5    ASSERT(!xi->tx_shadows[tx->id].cb);
     5.6    xi->tx_shadows[tx->id].cb = coalesce_buf;
     5.7 -  tx->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0, (ULONG)(MmGetPhysicalAddress(coalesce_buf).QuadPart >> PAGE_SHIFT), FALSE, gref, (ULONG)'XNTX');
     5.8 +  tx->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, (ULONG)(MmGetPhysicalAddress(coalesce_buf).QuadPart >> PAGE_SHIFT), FALSE, gref, (ULONG)'XNTX');
     5.9    xi->tx_shadows[tx->id].gref = tx->gref;
    5.10    tx->offset = 0;
    5.11    tx->size = (USHORT)length;
    5.12 @@ -380,7 +380,7 @@ XenNet_HWSendPacket(struct xennet_info *
    5.13        offset = MmGetMdlByteOffset(pi.curr_mdl) + pi.curr_mdl_offset;
    5.14        pfn = MmGetMdlPfnArray(pi.curr_mdl)[offset >> PAGE_SHIFT];
    5.15        txN->offset = (USHORT)offset & (PAGE_SIZE - 1);
    5.16 -      txN->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, 0, (ULONG)pfn, FALSE, gref, (ULONG)'XNTX');
    5.17 +      txN->gref = xi->vectors.GntTbl_GrantAccess(xi->vectors.context, (ULONG)pfn, FALSE, gref, (ULONG)'XNTX');
    5.18        ASSERT(xi->tx_shadows[txN->id].gref == INVALID_GRANT_REF);
    5.19        xi->tx_shadows[txN->id].gref = txN->gref;
    5.20        //ASSERT(sg->Elements[sg_element].Length > sg_offset);
     6.1 --- a/xenpci/xenpci_pdo.c	Sun Apr 15 15:13:54 2012 +1000
     6.2 +++ b/xenpci/xenpci_pdo.c	Sun Apr 15 15:34:10 2012 +1000
     6.3 @@ -203,7 +203,7 @@ XenPci_GetBackendAndAddWatch(WDFDEVICE d
     6.4      XenPci_FreeMem(res);
     6.5      return STATUS_UNSUCCESSFUL;
     6.6    }
     6.7 -  xppdd->backend_id = atoi(value);
     6.8 +  xppdd->backend_id = (domid_t)atoi(value);
     6.9    XenPci_FreeMem(value);
    6.10  
    6.11    /* Add watch on backend state */
    6.12 @@ -354,13 +354,13 @@ XenPci_EvtChn_Sync(PVOID context, PXEN_E
    6.13  }
    6.14  
    6.15  static grant_ref_t
    6.16 -XenPci_GntTbl_GrantAccess(PVOID context, domid_t domid, uint32_t frame, int readonly, grant_ref_t ref, ULONG tag)
    6.17 +XenPci_GntTbl_GrantAccess(PVOID context, uint32_t frame, int readonly, grant_ref_t ref, ULONG tag)
    6.18  {
    6.19    WDFDEVICE device = context;
    6.20    PXENPCI_PDO_DEVICE_DATA xppdd = GetXppdd(device);
    6.21    PXENPCI_DEVICE_DATA xpdd = GetXpdd(xppdd->wdf_device_bus_fdo);
    6.22    
    6.23 -  return GntTbl_GrantAccess(xpdd, domid, frame, readonly, ref, tag);
    6.24 +  return GntTbl_GrantAccess(xpdd, xppdd->backend_id, frame, readonly, ref, tag);
    6.25  }
    6.26  
    6.27  static BOOLEAN
     7.1 --- a/xenscsi/xenscsi.c	Sun Apr 15 15:13:54 2012 +1000
     7.2 +++ b/xenscsi/xenscsi.c	Sun Apr 15 15:34:10 2012 +1000
     7.3 @@ -635,7 +635,7 @@ XenScsi_PutSrbOnRing(PXENSCSI_DEVICE_DAT
     7.4      {
     7.5        return; /* better than crashing... */
     7.6      }
     7.7 -    xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, 0, shadow->req.seg[shadow->req.nr_segments].gref, (ULONG)'SCSI');
     7.8 +    xsdd->vectors.GntTbl_GrantAccess(xsdd->vectors.context, 0, (ULONG)pfn, shadow->req.seg[shadow->req.nr_segments].gref, (ULONG)'SCSI');
     7.9      shadow->req.seg[shadow->req.nr_segments].offset = (USHORT)(physical_address.LowPart & (PAGE_SIZE - 1));
    7.10      shadow->req.seg[shadow->req.nr_segments].length = (USHORT)min(PAGE_SIZE - (ULONG)shadow->req.seg[shadow->req.nr_segments].offset, remaining);
    7.11      remaining -= (ULONG)shadow->req.seg[shadow->req.nr_segments].length;
     8.1 --- a/xenusb/xenusb_fdo.c	Sun Apr 15 15:13:54 2012 +1000
     8.2 +++ b/xenusb/xenusb_fdo.c	Sun Apr 15 15:34:10 2012 +1000
     8.3 @@ -311,9 +311,6 @@ XenUsb_StartXenbusInit(PXENUSB_DEVICE_DA
     8.4        break;
     8.5      case XEN_INIT_TYPE_READ_STRING_FRONT:
     8.6        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_READ_STRING_FRONT - %s = %s\n", setting, value));
     8.7 -      if (strcmp(setting, "backend-id") == 0) {
     8.8 -        xudd->backend_id = (domid_t)atoi(value);
     8.9 -      }
    8.10        break;
    8.11      case XEN_INIT_TYPE_VECTORS:
    8.12        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_VECTORS\n"));
    8.13 @@ -447,7 +444,6 @@ XenUsb_EvtDevicePrepareHardware(WDFDEVIC
    8.14    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_RING, "conn-ring-ref", NULL, NULL);
    8.15    #pragma warning(suppress:4054)
    8.16    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_EVENT_CHANNEL_DPC, "event-channel", (PVOID)XenUsb_HandleEvent, xudd);
    8.17 -  ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_READ_STRING_FRONT, "backend-id", NULL, NULL);
    8.18    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_PRE_CONNECT, NULL, NULL, NULL);
    8.19    __ADD_XEN_INIT_UCHAR(&ptr, 0); /* no pre-connect required */
    8.20    ADD_XEN_INIT_REQ(&ptr, XEN_INIT_TYPE_XB_STATE_MAP_POST_CONNECT, NULL, NULL, NULL);
    8.21 @@ -990,7 +986,7 @@ XenUsb_EvtIoInternalDeviceControl_PVURB(
    8.22      partial_pvurb->req.buffer_length = (USHORT)MmGetMdlByteCount(partial_pvurb->mdl);
    8.23      partial_pvurb->req.nr_buffer_segs = (USHORT)ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(partial_pvurb->mdl), MmGetMdlByteCount(partial_pvurb->mdl));
    8.24      for (i = 0; i < partial_pvurb->req.nr_buffer_segs; i++) {
    8.25 -      partial_pvurb->req.seg[i].gref = xudd->vectors.GntTbl_GrantAccess(xudd->vectors.context, xudd->backend_id,
    8.26 +      partial_pvurb->req.seg[i].gref = xudd->vectors.GntTbl_GrantAccess(xudd->vectors.context,
    8.27             (ULONG)MmGetMdlPfnArray(partial_pvurb->mdl)[i], FALSE, INVALID_GRANT_REF, (ULONG)'XUSB');
    8.28        partial_pvurb->req.seg[i].offset = (USHORT)offset;
    8.29        partial_pvurb->req.seg[i].length = (USHORT)min((USHORT)remaining, (USHORT)PAGE_SIZE - offset);
     9.1 --- a/xenvbd/xenvbd_storport.c	Sun Apr 15 15:13:54 2012 +1000
     9.2 +++ b/xenvbd/xenvbd_storport.c	Sun Apr 15 15:34:10 2012 +1000
     9.3 @@ -605,7 +605,7 @@ XenVbd_PutQueuedSrbsOnRing(PXENVBD_DEVIC
     9.4          ULONG length;       
     9.5          physical_address = StorPortGetPhysicalAddress(xvdd, srb, ptr, &length);
     9.6        }
     9.7 -      gref = xvdd->vectors.GntTbl_GrantAccess(xvdd->vectors.context, 0,
     9.8 +      gref = xvdd->vectors.GntTbl_GrantAccess(xvdd->vectors.context,
     9.9               (ULONG)(physical_address.QuadPart >> PAGE_SHIFT), FALSE, INVALID_GRANT_REF, xvdd->grant_tag);
    9.10        if (gref == INVALID_GRANT_REF)
    9.11        {