win-pvdrivers

changeset 245:1b1f26917b6f

Moved some functions around to make packet handling functions accessible to rx and tx. Untested. Fixed a bug in xenvbd which was preventing xenvbd from booting on XP, but it may break other O/S's
author James Harper <james.harper@bendigoit.com.au>
date Sat Apr 05 14:33:33 2008 +1100 (2008-04-05)
parents d31884ed02a9
children 402fb735ce45
files common.inc xennet/sources xennet/xennet.h xennet/xennet_rx.c xennet/xennet_tx.c xenvbd/xenvbd.c
line diff
     1.1 --- a/common.inc	Wed Apr 02 00:21:09 2008 +1100
     1.2 +++ b/common.inc	Sat Apr 05 14:33:33 2008 +1100
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.8.8.4
     1.5 +VERSION=0.8.8.14
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  KMDF_VERSION=1
     1.8  !IF $(_NT_TOOLS_VERSION) > 0x700
     2.1 --- a/xennet/sources	Wed Apr 02 00:21:09 2008 +1100
     2.2 +++ b/xennet/sources	Sat Apr 05 14:33:33 2008 +1100
     2.3 @@ -4,4 +4,4 @@ TARGETTYPE=DRIVER
     2.4  INF_NAME=$(TARGETNAME)
     2.5  TARGETLIBS=$(TARGETLIBS) $(DDK_LIB_PATH)\ndis.lib
     2.6  MISCFILES=..\Target\$(DDK_TARGET_OS)\$(INF_NAME).inf
     2.7 -SOURCES=xennet.c xennet_tx.c xennet_rx.c xennet_oid.c
     2.8 +SOURCES=xennet.c xennet_tx.c xennet_rx.c xennet_oid.c xennet_common.c
     3.1 --- a/xennet/xennet.h	Wed Apr 02 00:21:09 2008 +1100
     3.2 +++ b/xennet/xennet.h	Sat Apr 05 14:33:33 2008 +1100
     3.3 @@ -61,6 +61,17 @@ Foundation, Inc., 51 Franklin Street, Fi
     3.4  
     3.5  #define ETH_ALEN 6
     3.6  
     3.7 +
     3.8 +#define __NET_USHORT_BYTE_0(x) ((USHORT)(x & 0xFF))
     3.9 +#define __NET_USHORT_BYTE_1(x) ((USHORT)((PUCHAR)&x)[1] & 0xFF)
    3.10 +
    3.11 +#define GET_NET_USHORT(x) ((__NET_USHORT_BYTE_0(x) << 8) | __NET_USHORT_BYTE_1(x))
    3.12 +#define SET_NET_USHORT(y, x) *((USHORT *)&(y)) = ((__NET_USHORT_BYTE_0(x) << 8) | __NET_USHORT_BYTE_1(x))
    3.13 +
    3.14 +#define GET_NET_ULONG(x) ((GET_NET_USHORT(x) << 16) | GET_NET_USHORT(((PUCHAR)&x)[2]))
    3.15 +#define SET_NET_ULONG(y, x) *((ULONG *)&(y)) = ((GET_NET_USHORT(x) << 16) | GET_NET_USHORT(((PUCHAR)&x)[2]))
    3.16 +
    3.17 +
    3.18  /* couldn't get regular xen ring macros to work...*/
    3.19  #define __NET_RING_SIZE(type, _sz) \
    3.20      (__RD32( \
    3.21 @@ -122,7 +133,7 @@ typedef struct {
    3.22    ULONG tcp_seq;
    3.23    BOOLEAN extra_info;
    3.24    BOOLEAN more_frags;
    3.25 -} rx_packet_info_t;
    3.26 +} packet_info_t;
    3.27  
    3.28  struct xennet_info
    3.29  {
    3.30 @@ -180,7 +191,7 @@ struct xennet_info
    3.31    PMDL page_list[NET_RX_RING_SIZE];
    3.32    ULONG page_free;
    3.33  
    3.34 -  rx_packet_info_t rxpi;
    3.35 +  packet_info_t rxpi;
    3.36  
    3.37    /* Receive-ring batched refills. */
    3.38    ULONG rx_target;
    3.39 @@ -291,3 +302,27 @@ XenNet_SetInformation(
    3.40    OUT PULONG BytesRead,
    3.41    OUT PULONG BytesNeeded
    3.42    );
    3.43 +
    3.44 +PUCHAR
    3.45 +XenNet_GetData(
    3.46 +  packet_info_t *pi,
    3.47 +  USHORT req_length,
    3.48 +  PUSHORT length
    3.49 +);
    3.50 +
    3.51 +
    3.52 +/* return values */
    3.53 +#define PARSE_OK 0
    3.54 +#define PARSE_TOO_SMALL 1 /* first buffer is too small */
    3.55 +#define PARSE_UNKNOWN_TYPE 2
    3.56 +
    3.57 +ULONG
    3.58 +XenNet_ParsePacketHeader(
    3.59 +  packet_info_t *pi
    3.60 +);
    3.61 +
    3.62 +VOID
    3.63 +XenNet_SumIpHeader(
    3.64 +  packet_info_t *pi,  
    3.65 +  PNDIS_PACKET packet
    3.66 +);
     4.1 --- a/xennet/xennet_rx.c	Wed Apr 02 00:21:09 2008 +1100
     4.2 +++ b/xennet/xennet_rx.c	Sat Apr 05 14:33:33 2008 +1100
     4.3 @@ -147,102 +147,6 @@ XenNet_RxBufferAlloc(struct xennet_info 
     4.4    return NDIS_STATUS_SUCCESS;
     4.5  }
     4.6  
     4.7 -#define __NET_USHORT_BYTE_0(x) ((USHORT)(x & 0xFF))
     4.8 -#define __NET_USHORT_BYTE_1(x) ((USHORT)((PUCHAR)&x)[1] & 0xFF)
     4.9 -
    4.10 -#define GET_NET_USHORT(x) ((__NET_USHORT_BYTE_0(x) << 8) | __NET_USHORT_BYTE_1(x))
    4.11 -#define SET_NET_USHORT(y, x) *((USHORT *)&(y)) = ((__NET_USHORT_BYTE_0(x) << 8) | __NET_USHORT_BYTE_1(x))
    4.12 -
    4.13 -#define GET_NET_ULONG(x) ((GET_NET_USHORT(x) << 16) | GET_NET_USHORT(((PUCHAR)&x)[2]))
    4.14 -#define SET_NET_ULONG(y, x) *((ULONG *)&(y)) = ((GET_NET_USHORT(x) << 16) | GET_NET_USHORT(((PUCHAR)&x)[2]))
    4.15 -
    4.16 -static VOID
    4.17 -XenNet_ParseHeader(
    4.18 -  struct xennet_info *xi
    4.19 -)
    4.20 -{
    4.21 -  UINT header_length;
    4.22 -
    4.23 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    4.24 -
    4.25 -  ASSERT(xi->rxpi.mdls[0]);
    4.26 -  
    4.27 -  NdisQueryBufferSafe(xi->rxpi.mdls[0], &xi->rxpi.header, &header_length, NormalPagePriority);
    4.28 -
    4.29 -  if (header_length < XN_HDR_SIZE + 20 + 20) // minimum size of first buffer is ETH + IP + TCP header
    4.30 -  {
    4.31 -    return;
    4.32 -  }
    4.33 -  
    4.34 -  switch (GET_NET_USHORT(xi->rxpi.header[12])) // L2 protocol field
    4.35 -  {
    4.36 -  case 0x0800:
    4.37 -    xi->rxpi.ip_version = (xi->rxpi.header[XN_HDR_SIZE + 0] & 0xF0) >> 4;
    4.38 -    if (xi->rxpi.ip_version != 4)
    4.39 -    {
    4.40 -      KdPrint((__DRIVER_NAME "     ip_version = %d\n", xi->rxpi.ip_version));
    4.41 -      return;
    4.42 -    }
    4.43 -    xi->rxpi.ip4_header_length = (xi->rxpi.header[XN_HDR_SIZE + 0] & 0x0F) << 2;
    4.44 -    if (header_length < (ULONG)(xi->rxpi.ip4_header_length + 20))
    4.45 -    {
    4.46 -      KdPrint((__DRIVER_NAME "     first packet is only %d long, must be >= %d\n", XN_HDR_SIZE + header_length, (ULONG)(XN_HDR_SIZE + xi->rxpi.ip4_header_length + 20)));
    4.47 -      // we need to do something conclusive here...
    4.48 -      return;
    4.49 -    }
    4.50 -    break;
    4.51 -  default:
    4.52 -//    KdPrint((__DRIVER_NAME "     Not IP\n"));
    4.53 -    return;
    4.54 -  }
    4.55 -  xi->rxpi.ip_proto = xi->rxpi.header[XN_HDR_SIZE + 9];
    4.56 -  switch (xi->rxpi.ip_proto)
    4.57 -  {
    4.58 -  case 6:  // TCP
    4.59 -  case 17: // UDP
    4.60 -    break;
    4.61 -  default:
    4.62 -    return;
    4.63 -  }
    4.64 -  xi->rxpi.ip4_length = GET_NET_USHORT(xi->rxpi.header[XN_HDR_SIZE + 2]);
    4.65 -  xi->rxpi.tcp_header_length = (xi->rxpi.header[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 12] & 0xf0) >> 2;
    4.66 -  xi->rxpi.tcp_length = xi->rxpi.ip4_length - xi->rxpi.ip4_header_length - xi->rxpi.tcp_header_length;
    4.67 -  xi->rxpi.tcp_remaining = xi->rxpi.tcp_length;
    4.68 -  xi->rxpi.tcp_seq = GET_NET_ULONG(xi->rxpi.header[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 4]);
    4.69 -  if (xi->rxpi.mss > 0 && xi->rxpi.tcp_length > xi->rxpi.mss)
    4.70 -    xi->rxpi.split_required = TRUE;
    4.71 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    4.72 -}
    4.73 -
    4.74 -static VOID
    4.75 -XenNet_SumIpHeader(
    4.76 -  struct xennet_info *xi,  
    4.77 -  PNDIS_PACKET packet
    4.78 -)
    4.79 -{
    4.80 -  PMDL mdl;
    4.81 -  UINT total_length;
    4.82 -  UINT buffer_length;
    4.83 -  PUCHAR buffer;
    4.84 -  ULONG csum = 0;
    4.85 -  USHORT i;
    4.86 -
    4.87 -  NdisGetFirstBufferFromPacketSafe(packet, &mdl, &buffer, &buffer_length, &total_length, NormalPagePriority);
    4.88 -  ASSERT(mdl);
    4.89 -
    4.90 -  buffer[XN_HDR_SIZE + 10] = 0;
    4.91 -  buffer[XN_HDR_SIZE + 11] = 0;
    4.92 -  for (i = 0; i < xi->rxpi.ip4_header_length; i += 2)
    4.93 -  {
    4.94 -    csum += GET_NET_USHORT(buffer[XN_HDR_SIZE + i]);
    4.95 -  }
    4.96 -  while (csum & 0xFFFF0000)
    4.97 -    csum = (csum & 0xFFFF) + (csum >> 16);
    4.98 -  csum = ~csum;
    4.99 -  SET_NET_USHORT(buffer[XN_HDR_SIZE + 10], csum);
   4.100 -}
   4.101 -
   4.102 -
   4.103  /*
   4.104   Windows appears to insist that the checksum on received packets is correct, and won't
   4.105   believe us when we lie about it, which happens when the packet is generated on the
   4.106 @@ -251,7 +155,7 @@ XenNet_SumIpHeader(
   4.107  */
   4.108  static VOID
   4.109  XenNet_SumPacketData(
   4.110 -  struct xennet_info *xi,  
   4.111 +  packet_info_t *pi,  
   4.112    PNDIS_PACKET packet
   4.113  )
   4.114  {
   4.115 @@ -282,16 +186,16 @@ XenNet_SumPacketData(
   4.116      KdPrint((__DRIVER_NAME "     Size Mismatch %d (ip4_length + XN_HDR_SIZE) != %d (total_length)\n", ip4_length + XN_HDR_SIZE, total_length));
   4.117    }
   4.118  
   4.119 -  switch (xi->rxpi.ip_proto)
   4.120 +  switch (pi->ip_proto)
   4.121    {
   4.122    case 6:
   4.123 -    csum_ptr = (USHORT *)&buffer[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 16];
   4.124 +    csum_ptr = (USHORT *)&buffer[XN_HDR_SIZE + pi->ip4_header_length + 16];
   4.125      break;
   4.126    case 17:
   4.127 -    csum_ptr = (USHORT *)&buffer[XN_HDR_SIZE + xi->rxpi.ip4_header_length + 6];
   4.128 +    csum_ptr = (USHORT *)&buffer[XN_HDR_SIZE + pi->ip4_header_length + 6];
   4.129      break;
   4.130    default:
   4.131 -    KdPrint((__DRIVER_NAME "     Don't know how to calc sum for IP Proto %d\n", xi->rxpi.ip_proto));
   4.132 +    KdPrint((__DRIVER_NAME "     Don't know how to calc sum for IP Proto %d\n", pi->ip_proto));
   4.133      return;
   4.134    }
   4.135      
   4.136 @@ -302,11 +206,11 @@ XenNet_SumPacketData(
   4.137    csum += GET_NET_USHORT(buffer[XN_HDR_SIZE + 16]) + GET_NET_USHORT(buffer[XN_HDR_SIZE + 18]); // dst
   4.138    csum += ((USHORT)buffer[XN_HDR_SIZE + 9]);
   4.139  
   4.140 -  remaining = ip4_length - xi->rxpi.ip4_header_length;
   4.141 +  remaining = ip4_length - pi->ip4_header_length;
   4.142  
   4.143    csum += remaining;
   4.144  
   4.145 -  for (buffer_offset = i = XN_HDR_SIZE + xi->rxpi.ip4_header_length; i < total_length - 1; i += 2, buffer_offset += 2)
   4.146 +  for (buffer_offset = i = XN_HDR_SIZE + pi->ip4_header_length; i < total_length - 1; i += 2, buffer_offset += 2)
   4.147    {
   4.148      if (buffer_offset == buffer_length - 1) // deal with a buffer ending on an odd byte boundary
   4.149      {
   4.150 @@ -352,34 +256,6 @@ XenNet_SumPacketData(
   4.151  //  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.152  }
   4.153  
   4.154 -static PUCHAR
   4.155 -XenNet_GetData(
   4.156 -  struct xennet_info *xi,
   4.157 -  USHORT req_length,
   4.158 -  PUSHORT length
   4.159 -)
   4.160 -{
   4.161 -  PNDIS_BUFFER mdl = xi->rxpi.mdls[xi->rxpi.curr_mdl];
   4.162 -  PUCHAR buffer = (PUCHAR)MmGetMdlVirtualAddress(mdl) + xi->rxpi.curr_mdl_offset;
   4.163 -
   4.164 -//  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   4.165 -
   4.166 -  *length = (USHORT)min(req_length, MmGetMdlByteCount(mdl) - xi->rxpi.curr_mdl_offset);
   4.167 -
   4.168 -//  KdPrint((__DRIVER_NAME "     req_length = %d, length = %d\n", req_length, *length));
   4.169 -
   4.170 -  xi->rxpi.curr_mdl_offset = xi->rxpi.curr_mdl_offset + *length;
   4.171 -  if (xi->rxpi.curr_mdl_offset == MmGetMdlByteCount(mdl))
   4.172 -  {
   4.173 -    xi->rxpi.curr_mdl++;
   4.174 -    xi->rxpi.curr_mdl_offset = 0;
   4.175 -  }
   4.176 -
   4.177 -//  KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
   4.178 -
   4.179 -  return buffer;
   4.180 -}
   4.181 -
   4.182  static PNDIS_PACKET
   4.183  XenNet_MakePacket(
   4.184    struct xennet_info *xi
   4.185 @@ -450,7 +326,7 @@ XenNet_MakePackets(
   4.186  
   4.187  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "(packets = %p, packet_count = %d)\n", packets, *packet_count_p));
   4.188  
   4.189 -  XenNet_ParseHeader(xi);
   4.190 +  XenNet_ParsePacketHeader(xi);
   4.191    switch (xi->rxpi.ip_proto)
   4.192    {
   4.193    case 6:  // TCP
     5.1 --- a/xennet/xennet_tx.c	Wed Apr 02 00:21:09 2008 +1100
     5.2 +++ b/xennet/xennet_tx.c	Sat Apr 05 14:33:33 2008 +1100
     5.3 @@ -84,6 +84,7 @@ put_gref_on_freelist(struct xennet_info 
     5.4  
     5.5  #define SWAP_USHORT(x) (USHORT)((((x & 0xFF) << 8)|((x >> 8) & 0xFF)))
     5.6  
     5.7 +#if 0
     5.8  /*
     5.9   * Windows assumes that if we can do large send offload then we can
    5.10   * do IP header csum offload, so we have to fake it!
    5.11 @@ -94,6 +95,7 @@ XenNet_SumIpHeader(
    5.12  )
    5.13  {
    5.14    PVOID buffer = MmGetSystemAddressForMdlSafe(mdl, NormalPagePriority);
    5.15 +  USHORT buffer_length = (USHORT)MmGetMdlByteCount(mdl);
    5.16    PUSHORT ushorts = (PUSHORT)buffer;
    5.17  
    5.18    USHORT length_in_ushorts;
    5.19 @@ -104,10 +106,19 @@ XenNet_SumIpHeader(
    5.20    switch (SWAP_USHORT(ushorts[6]))
    5.21    {
    5.22    case 0x0800:
    5.23 +    if (buffer_length < XN_HDR_SIZE + 20)
    5.24 +    {
    5.25 +      KdPrint((__DRIVER_NAME "     tx packet too small for ip header - only %d bytes long but needs %d bytes\n", buffer_length, XN_HDR_SIZE + 20));
    5.26 +      return;
    5.27 +    }
    5.28      /* check if buffer is long enough to contain ethernet header + minimum ip header */
    5.29      ushorts = &ushorts[0x07];
    5.30      length_in_ushorts = ((SWAP_USHORT(ushorts[0]) >> 8) & 0x0F) * 2;
    5.31 -    /* check if buffer is long enough to contain options too */
    5.32 +    if (buffer_length < XN_HDR_SIZE + length_in_ushorts * 2)
    5.33 +    {
    5.34 +      KdPrint((__DRIVER_NAME "     tx packet too small for ip header + options - only %d bytes long but needs %d bytes\n", buffer_length, XN_HDR_SIZE + length_in_ushorts));
    5.35 +      return;
    5.36 +    }
    5.37      break;
    5.38    default:
    5.39      return;
    5.40 @@ -121,6 +132,7 @@ XenNet_SumIpHeader(
    5.41      csum = (csum & 0xFFFF) + (csum >> 16);
    5.42    ushorts[5] = SWAP_USHORT(~csum);
    5.43  }
    5.44 +#endif
    5.45  
    5.46  typedef struct
    5.47  {
    5.48 @@ -128,26 +140,22 @@ typedef struct
    5.49    USHORT offset;
    5.50    USHORT length;
    5.51  } page_element_t;
    5.52 -  
    5.53  
    5.54  static VOID
    5.55  XenNet_BuildPageList(PNDIS_PACKET packet, page_element_t *elements, PUSHORT num_elements)
    5.56  {
    5.57    USHORT element_num = 0;
    5.58    UINT offset;
    5.59 -  PVOID addr;
    5.60    UINT remaining;
    5.61    ULONG pages;
    5.62    USHORT page;
    5.63    PMDL buffer;
    5.64    PPFN_NUMBER pfns;
    5.65  
    5.66 -  NdisQueryPacket(packet, NULL, NULL, &buffer, NULL);
    5.67 +  buffer = NDIS_PACKET_FIRST_NDIS_BUFFER(packet);
    5.68  
    5.69 -//  sg_list = NDIS_PER_PACKET_INFO_FROM_PACKET(packet, ScatterGatherListPacketInfo);
    5.70    while (buffer != NULL)
    5.71    {
    5.72 -    addr = MmGetSystemAddressForMdlSafe(buffer, NormalPagePriority);
    5.73      offset = MmGetMdlByteOffset(buffer);
    5.74      remaining = MmGetMdlByteCount(buffer);
    5.75      pages = ADDRESS_AND_SIZE_TO_SPAN_PAGES(MmGetMdlVirtualAddress(buffer), remaining);
    5.76 @@ -165,6 +173,21 @@ XenNet_BuildPageList(PNDIS_PACKET packet
    5.77      NdisGetNextBuffer(buffer, &buffer);
    5.78    }
    5.79    *num_elements = element_num;
    5.80 +#if 0
    5.81 +  if (is_csum_offload && elements[0].length < 54)
    5.82 +  {
    5.83 +    element_num = 0;
    5.84 +    if (min(remaining, PAGE_SIZE - offset) < 54) /* first page must contain full header */
    5.85 +    {
    5.86 +      // allocate a new page
    5.87 +      first_page_len = 0;
    5.88 +      do {
    5.89 +        page_len = 
    5.90 +        // copy data to 
    5.91 +      } while (first_page_len <= 54)
    5.92 +    }
    5.93 +  }
    5.94 +#endif
    5.95  }
    5.96  
    5.97  /* Place a buffer on tx ring. */
    5.98 @@ -239,6 +262,7 @@ XenNet_HWSendPacket(struct xennet_info *
    5.99    if (csum_info->Transmit.NdisPacketTcpChecksum
   5.100      || csum_info->Transmit.NdisPacketUdpChecksum)
   5.101    {
   5.102 +KdPrint((__DRIVER_NAME "     TxCsumOffload - size = %d, pfn = %08x, offset = %04x\n", elements[0].length, elements[0].pfn, elements[0].offset));
   5.103      flags |= NETTXF_csum_blank | NETTXF_data_validated;
   5.104      PC_INC(ProfCount_TxPacketsCsumOffload);
   5.105    }
   5.106 @@ -246,7 +270,7 @@ XenNet_HWSendPacket(struct xennet_info *
   5.107    if (mss > 0)
   5.108    {
   5.109      flags |= NETTXF_extra_info;
   5.110 -    XenNet_SumIpHeader(first_buffer);
   5.111 +//    XenNet_SumIpHeader(first_buffer);
   5.112      PC_INC(ProfCount_TxPacketsLargeOffload);
   5.113    }
   5.114  
   5.115 @@ -255,8 +279,7 @@ XenNet_HWSendPacket(struct xennet_info *
   5.116     * (C) rest of requests on the ring. Only (A) has csum flags.
   5.117     */
   5.118    /* (A) */
   5.119 -  tx = XenNet_PutOnTxRing(xi, elements[0].pfn, elements[0].offset, elements[0].length, flags);
   5.120 -  tx->size = (uint16_t)total_packet_length; /* 1st req size always tot pkt len */
   5.121 +  tx = XenNet_PutOnTxRing(xi, elements[0].pfn, elements[0].offset, (USHORT)total_packet_length, flags);
   5.122    xi->tx.req_prod_pvt++;
   5.123  
   5.124    /* (B) */
   5.125 @@ -277,6 +300,8 @@ XenNet_HWSendPacket(struct xennet_info *
   5.126    /* (C) */
   5.127    for (element_num = 1; element_num < num_elements; element_num++)
   5.128    {
   5.129 +if (csum_info->Transmit.NdisPacketTcpChecksum || csum_info->Transmit.NdisPacketUdpChecksum)
   5.130 +KdPrint((__DRIVER_NAME "                   - size = %d, pfn = %08x, offset = %04x\n", elements[element_num].length, elements[element_num].pfn, elements[element_num].offset));
   5.131      //KdPrint((__DRIVER_NAME "     i = %d\n", i));
   5.132      tx = XenNet_PutOnTxRing(xi, elements[element_num].pfn,
   5.133        elements[element_num].offset, elements[element_num].length,
     6.1 --- a/xenvbd/xenvbd.c	Wed Apr 02 00:21:09 2008 +1100
     6.2 +++ b/xenvbd/xenvbd.c	Sat Apr 05 14:33:33 2008 +1100
     6.3 @@ -766,7 +766,6 @@ XenVbd_HwScsiFindAdapter(PVOID DeviceExt
     6.4  
     6.5    DeviceData->DeviceExtension = DeviceExtension;
     6.6  
     6.7 -  ConfigInfo->Master = TRUE; // Won't work under x64 or on x32 with >4G memory without this...
     6.8    ConfigInfo->MaximumTransferLength = BLKIF_MAX_SEGMENTS_PER_REQUEST * PAGE_SIZE;
     6.9    ConfigInfo->NumberOfPhysicalBreaks = BLKIF_MAX_SEGMENTS_PER_REQUEST - 1;
    6.10    ConfigInfo->ScatterGather = TRUE;
    6.11 @@ -779,7 +778,16 @@ XenVbd_HwScsiFindAdapter(PVOID DeviceExt
    6.12    ConfigInfo->MaximumNumberOfLogicalUnits = 1;
    6.13    ConfigInfo->MaximumNumberOfTargets = SCSI_TARGETS_PER_BUS;
    6.14    if (ConfigInfo->Dma64BitAddresses == SCSI_DMA64_SYSTEM_SUPPORTED)
    6.15 +  {
    6.16 +    ConfigInfo->Master = TRUE;
    6.17      ConfigInfo->Dma64BitAddresses = SCSI_DMA64_MINIPORT_SUPPORTED;
    6.18 +    KdPrint((__DRIVER_NAME "     Dma64BitAddresses supported\n"));
    6.19 +  }
    6.20 +  else
    6.21 +  {
    6.22 +    ConfigInfo->Master = FALSE;
    6.23 +    KdPrint((__DRIVER_NAME "     Dma64BitAddresses not supported\n"));
    6.24 +  }
    6.25  
    6.26    // This all has to be initialized here as the real Initialize routine
    6.27    // is called at DIRQL, and the XenBus stuff has to be called at