Win2k SCSI Miniport driver

I am working on a Win2k SCSI Miniport driver. After getting called in the
DriverEntry, FindAdapter and InitializeAdapter I am getting calls to the
StartIO routine for a Read SRB (0x28)which have a block# of 0, number of
blocks of 0 in the CDB but a DataTransferLength that is non-zero (usually
32K).

Which is correct - are there 0 block reads that have the
DataTransferLength
set or is the # blocks field in the CDB incorrect in which case do I need
to calculate the correct number of blocks using the DataTransferLength?

Thanks for any help.

Hi!

You need always decode CDB and extract the transfer length from it.
Make sure you have enogh memory in user’s (it’s not usually) data buffer.
Transfer lengths of 0 are normal. Just return success.

Anton

I am working on a Win2k SCSI Miniport driver. After getting called in the
DriverEntry, FindAdapter and InitializeAdapter I am getting calls to the
StartIO routine for a Read SRB (0x28)which have a block# of 0, number of
blocks of 0 in the CDB but a DataTransferLength that is non-zero (usually
32K).

Which is correct - are there 0 block reads that have the
DataTransferLength
set or is the # blocks field in the CDB incorrect in which case do I need
to calculate the correct number of blocks using the DataTransferLength?

Thanks for any help.

I must disagree with this. Here is a snippet from a miniport driver I
wrote several years ago.

// Setup the context.
luExtension->Srb = Srb;
luExtension->DataPointer = Srb->DataBuffer;
luExtension->DataLength = Srb->DataTransferLength;

I always get the transfer length from he Srb and this driver has had
zero bugs since it was written; at least none have been reported :slight_smile:

In subsequent code, I use the luExtension->DataLength for DMA transfer
sizes.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Anton Kolomyeytsev
Sent: Tuesday, August 13, 2002 7:19 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

Hi!

You need always decode CDB and extract the transfer length from it.
Make sure you have enogh memory in user’s (it’s not usually) data
buffer.
Transfer lengths of 0 are normal. Just return success.

Anton

I am working on a Win2k SCSI Miniport driver. After getting called in
the
DriverEntry, FindAdapter and InitializeAdapter I am getting calls to
the
StartIO routine for a Read SRB (0x28)which have a block# of 0, number
of
blocks of 0 in the CDB but a DataTransferLength that is non-zero
(usually
32K).

Which is correct - are there 0 block reads that have the
DataTransferLength
set or is the # blocks field in the CDB incorrect in which case do I
need
to calculate the correct number of blocks using the
DataTransferLength?

Thanks for any help.


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

“The transfer length field specifies the number of contiguous logical blocks
of data to be transferred. A transfer length of zero indicates that 256
logical blocks shall be transferred. Any other value indicates the number of
logical blocks that shall be transferred.”

Thus spake scsi-2.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, August 13, 2002 12:32 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

I must disagree with this. Here is a snippet from a miniport
driver I wrote several years ago.

// Setup the context.
luExtension->Srb = Srb;
luExtension->DataPointer = Srb->DataBuffer;
luExtension->DataLength = Srb->DataTransferLength;

I always get the transfer length from he Srb and this driver
has had zero bugs since it was written; at least none have
been reported :slight_smile:

In subsequent code, I use the luExtension->DataLength for DMA
transfer sizes.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On > Behalf Of Anton
Kolomyeytsev
Sent: Tuesday, August 13, 2002 7:19 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

Hi!

You need always decode CDB and extract the transfer length
from it. Make sure you have enogh memory in user’s (it’s not
usually) data buffer. Transfer lengths of 0 are normal. Just
return success.

Anton

> I am working on a Win2k SCSI Miniport driver. After
getting called in
the
> DriverEntry, FindAdapter and InitializeAdapter I am getting calls to
the
> StartIO routine for a Read SRB (0x28)which have a block# of
0, number
of
> blocks of 0 in the CDB but a DataTransferLength that is non-zero
(usually
> 32K).
>
> Which is correct - are there 0 block reads that have the
> DataTransferLength set or is the # blocks field in the CDB
incorrect
> in which case do I
need
> to calculate the correct number of blocks using the
DataTransferLength?
>
> Thanks for any help.


You are currently subscribed to ntdev as:
xxxxx@storagecraft.com To unsubscribe send a blank email to
%%email.unsub%%


You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
%%email.unsub%%

And we saw that it was good…

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Roddy, Mark
Sent: Tuesday, August 13, 2002 10:24 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

“The transfer length field specifies the number of contiguous logical
blocks
of data to be transferred. A transfer length of zero indicates that 256
logical blocks shall be transferred. Any other value indicates the
number of
logical blocks that shall be transferred.”

Thus spake scsi-2.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, August 13, 2002 12:32 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

I must disagree with this. Here is a snippet from a miniport
driver I wrote several years ago.

// Setup the context.
luExtension->Srb = Srb;
luExtension->DataPointer = Srb->DataBuffer;
luExtension->DataLength = Srb->DataTransferLength;

I always get the transfer length from he Srb and this driver
has had zero bugs since it was written; at least none have
been reported :slight_smile:

In subsequent code, I use the luExtension->DataLength for DMA
transfer sizes.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On > Behalf Of Anton
Kolomyeytsev
Sent: Tuesday, August 13, 2002 7:19 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

Hi!

You need always decode CDB and extract the transfer length
from it. Make sure you have enogh memory in user’s (it’s not
usually) data buffer. Transfer lengths of 0 are normal. Just
return success.

Anton

> I am working on a Win2k SCSI Miniport driver. After
getting called in
the
> DriverEntry, FindAdapter and InitializeAdapter I am getting calls to
the
> StartIO routine for a Read SRB (0x28)which have a block# of
0, number
of
> blocks of 0 in the CDB but a DataTransferLength that is non-zero
(usually
> 32K).
>
> Which is correct - are there 0 block reads that have the
> DataTransferLength set or is the # blocks field in the CDB
incorrect
> in which case do I
need
> to calculate the correct number of blocks using the
DataTransferLength?
>
> Thanks for any help.


You are currently subscribed to ntdev as:
xxxxx@storagecraft.com To unsubscribe send a blank email to
%%email.unsub%%


You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
%%email.unsub%%


You are currently subscribed to ntdev as: xxxxx@storagecraft.com
To unsubscribe send a blank email to %%email.unsub%%

Hi!

Very very very interesting… This is what I have in my SCSI-2 spec:

“The transfer length field specifies the number of contiguous logical
blocks of data that shall be transferred. A transfer
length of zero indicates that no logical blocks shall be transferred. This
condition shall not be considered an error.
Any other value indicates the number of logical blocks that shall be
transferred.”

It looks like we have different SCSI-2 specs -) BTW, ->DataTransferLength
in described case was also 0 and SCSI miniport was reporting of capable
only of 64KB transfers. It will be very strange if someone will try to
read 128KB in this situation.

Regards,
Anton A. Kolomyeytsev

“The transfer length field specifies the number of contiguous logical
blocks
of data to be transferred. A transfer length of zero indicates that 256
logical blocks shall be transferred. Any other value indicates the number
of
logical blocks that shall be transferred.”

Thus spake scsi-2.

-----Original Message-----
From: Jamey Kirby [mailto:xxxxx@storagecraft.com]
Sent: Tuesday, August 13, 2002 12:32 PM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

I must disagree with this. Here is a snippet from a miniport
driver I wrote several years ago.

// Setup the context.
luExtension->Srb = Srb;
luExtension->DataPointer = Srb->DataBuffer;
luExtension->DataLength = Srb->DataTransferLength;

I always get the transfer length from he Srb and this driver
has had zero bugs since it was written; at least none have
been reported :slight_smile:

In subsequent code, I use the luExtension->DataLength for DMA
transfer sizes.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On > Behalf Of Anton
Kolomyeytsev
Sent: Tuesday, August 13, 2002 7:19 AM
To: NT Developers Interest List
Subject: [ntdev] Re: Win2k SCSI Miniport driver

Hi!

You need always decode CDB and extract the transfer length
from it. Make sure you have enogh memory in user’s (it’s not
usually) data buffer. Transfer lengths of 0 are normal. Just
return success.

Anton

> I am working on a Win2k SCSI Miniport driver. After
getting called in
the
> DriverEntry, FindAdapter and InitializeAdapter I am getting calls to
the
> StartIO routine for a Read SRB (0x28)which have a block# of
0, number
of
> blocks of 0 in the CDB but a DataTransferLength that is non-zero
(usually
> 32K).
>
> Which is correct - are there 0 block reads that have the
> DataTransferLength set or is the # blocks field in the CDB
incorrect
> in which case do I
need
> to calculate the correct number of blocks using the
DataTransferLength?
>
> Thanks for any help.


You are currently subscribed to ntdev as:
xxxxx@storagecraft.com To unsubscribe send a blank email to
%%email.unsub%%


You are currently subscribed to ntdev as:
xxxxx@stratus.com To unsubscribe send a blank email to
%%email.unsub%%

>"The transfer length field specifies the number of contiguous logical

blocks of data that shall be transferred. A transfer
length of zero indicates that no logical blocks shall be transferred. This
condition shall not be considered an error.
Any other value indicates the number of logical blocks that shall be
transferred."

It looks like we have different SCSI-2 specs -) BTW, ->DataTransferLength
in described case was also 0 and SCSI miniport was reporting of capable
only of 64KB transfers. It will be very strange if someone will try to
read 128KB in this situation.

The version of the SCSI spec I have, which I paid money to ANSI for earlier
this year (document ANSI NCITS 351-2001) says:

4.3.4.4 Transfer length

The TRANSFER LENGTH field specifies the amount of data to be transferred,
usually the number of blocks. Some
commands use transfer length to specify the requested number of bytes to be
sent as defined in the command
description. See the following descriptions and the individual command
descriptions for further information.

Commands that use one byte for the TRANSFER LENGTH field allow up to 256
blocks of data to be transferred by one
command. A TRANSFER LENGTH value of 1 to 255 indicates the number of blocks
that shall be transferred. A value
of zero specifies that 256 blocks shall be transferred.

In commands that use multiple bytes for the TRANSFER LENGTH field, a
transfer length of zero indicates that no data
transfer shall take place. A value of one or greater indicates the number
of blocks that shall be transferred.

  • Jan

Hmmm… somehow (more heatstroke?) I thought the original post was about
a read6 command. I was wrong. It was a read10 and indeed the transfer
length of zero would appear to be zero, not 64K of logical blocks.

So the next question is how did this get through the class drivers,
which, unless I once again have suffered heatstroke delusions, cuts short
zero length transfers by returning success?

I now like planA: just return success from the miniport, or plan9: send
it to the device and let the device go fish.

===========================
Mark Roddy
Consultant, Microsoft DDK MVP
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032

-----Original Message-----
From: Jan Bottorff
To: “NT Developers Interest List”
Date: Thu, 15 Aug 2002 15:37:43 -0700
Subject: [ntdev] Re: Win2k SCSI Miniport driver

>
> >“The transfer length field specifies the number of contiguous logical
> >blocks of data that shall be transferred. A transfer
> >length of zero indicates that no logical blocks shall be transferred.
> This
> >condition shall not be considered an error.
> >Any other value indicates the number of logical blocks that shall be
> >transferred.”
> >
> >It looks like we have different SCSI-2 specs -) BTW,
> ->DataTransferLength
> >in described case was also 0 and SCSI miniport was reporting of
> capable
> >only of 64KB transfers. It will be very strange if someone will try to
> >read 128KB in this situation.
>
> The version of the SCSI spec I have, which I paid money to ANSI for
> earlier
> this year (document ANSI NCITS 351-2001) says:
>
> 4.3.4.4 Transfer length
>
> The TRANSFER LENGTH field specifies the amount of data to be
> transferred,
> usually the number of blocks. Some
> commands use transfer length to specify the requested number of bytes
> to be
> sent as defined in the command
> description. See the following descriptions and the individual command
> descriptions for further information.
>
> Commands that use one byte for the TRANSFER LENGTH field allow up to
> 256
> blocks of data to be transferred by one
> command. A TRANSFER LENGTH value of 1 to 255 indicates the number of
> blocks
> that shall be transferred. A value
> of zero specifies that 256 blocks shall be transferred.
>
> In commands that use multiple bytes for the TRANSFER LENGTH field, a
> transfer length of zero indicates that no data
> transfer shall take place. A value of one or greater indicates the
> number
> of blocks that shall be transferred.
>
> - Jan
>
>
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@hollistech.com
> To unsubscribe send a blank email to %%email.unsub%%