[Fwd: Scatter Gather List on 64 Bit Windows]

In ntddk.h, we find this:

typedef struct _SCATTER_GATHER_ELEMENT {
PHYSICAL_ADDRESS Address;
ULONG Length;
ULONG_PTR Reserved;
} SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;

typedef struct _SCATTER_GATHER_LIST {
ULONG NumberOfElements;
ULONG_PTR Reserved;
SCATTER_GATHER_ELEMENT Elements;
} SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;

I’d like to know who decided to make those Reserved fields ULONG_PTRs, so
I could enroll them on a whole bunch of spam lists. Our PCIExpress
bus-master DMA hardware was designed to traverse a SCATTER_GATHER_LIST,
and I suspect we are not alone in that. Well, in a 64-bit driver, the
size of that structure changes. Now we will have to define our own
structure and copy.

The stupid thing is that those reserved fields are probably used for
nothing other than padding to an 8-byte boundary, something which they
absolutely fail to do in a 64-bit compile.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

Tim,

A stupid question, but sometimes the simplest things are overlooked.

Did you try #pragma pack(pop/push, ?) before and after … hmmmm but that
would mean you would have to copy those structs out … and even if you put
a pop before the include file, if the include file has a diff pack … oh
well …

Damn, don’t you just hate it when you shoot down your own idea even as you
write it?


The personal opinion of
Gary G. Little

“Tim Roberts” wrote in message news:xxxxx@ntdev…
> In ntddk.h, we find this:
>
> typedef struct _SCATTER_GATHER_ELEMENT {
> PHYSICAL_ADDRESS Address;
> ULONG Length;
> ULONG_PTR Reserved;
> } SCATTER_GATHER_ELEMENT, *PSCATTER_GATHER_ELEMENT;
>
> typedef struct _SCATTER_GATHER_LIST {
> ULONG NumberOfElements;
> ULONG_PTR Reserved;
> SCATTER_GATHER_ELEMENT Elements;
> } SCATTER_GATHER_LIST, *PSCATTER_GATHER_LIST;
>
> I’d like to know who decided to make those Reserved fields ULONG_PTRs, so
> I could enroll them on a whole bunch of spam lists. Our PCIExpress
> bus-master DMA hardware was designed to traverse a SCATTER_GATHER_LIST,
> and I suspect we are not alone in that. Well, in a 64-bit driver, the
> size of that structure changes. Now we will have to define our own
> structure and copy.
>
> The stupid thing is that those reserved fields are probably used for
> nothing other than padding to an 8-byte boundary, something which they
> absolutely fail to do in a 64-bit compile.
>
> –
> Tim Roberts, xxxxx@probo.com
> Providenza & Boekelheide, Inc.
>
>

> I could enroll them on a whole bunch of spam lists. Our PCIExpress

bus-master DMA hardware was designed to traverse a SCATTER_GATHER_LIST,

So are:

  • usual PCI OHCI 1394 controller
  • usual PCI UHCI USB controller
  • usual PCI OHCI USB controller
  • (to some degree) most IDE controllers
  • aic78xx SCSI controller line
  • and so on

Yes, all these hardware pieces require you to convert the SG list to their
internal format, but the logic is exactly as Tim told us.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com