SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension buffer as a command table for the HBA, but the HBA spec has a restriction that this buffer’s physical address should be aligned on a 128 byte cache line.

I couldn’t find any place where I can tell the port to provide me a buffer with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the ScsiPortGetUncachedExtension(). I was planning to move ahead in the buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the physical address of the SrbExtension, I am getting a non-aligned addr (expected) and a large length value. Then when I call ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar

For the ATAport, the sample code comments like…

"
The alignment of the addresses (virtual and physical) returned by the function follow these rules

  • the address returned by AtaPortGetUnCachedExtension will have both its virtual and physical addresses page aligned
  • the memory received through the IRB will either be physically and virtually 4K aligned or IrbExtensionSize aligned. The first allocation will be on a 4K boundry the address of the second will be IrbExtensionSize larger than the first, the third will be IrbExtensionSize larger than the second, etc.
    "

This is what I am expecting from the SCSIport. Why is it not coming aligned? This is important, as I cannot allocate a huge Uncached Extension (which seems to affect the hibernate, from what I have read). This HBA has multiple slots per channel and 2 channels, so the size of uncached extension might become high incase I want to allocate upfront from uncached ext.

Thanks,
Sreekumar

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual
address whatever offset you added to the physical address to get the
aligned address.

From a ScsiPort disassembly, I’m not sure I would trust
ScsiPortGetVirtualAddress to work for addresses in the range of the
SrbExtenaion. The StorPort function, on the other hand, calls
(undocumented) MmGetVirtualFromPhysical.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com
06/19/2009 02:22 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension
buffer as a command table for the HBA, but the HBA spec has a restriction
that this buffer’s physical address should be aligned on a 128 byte cache
line.

I couldn’t find any place where I can tell the port to provide me a buffer
with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both
HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling
the ScsiPortGetUncachedExtension(). I was planning to move ahead in the
buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the
physical address of the SrbExtension, I am getting a non-aligned addr
(expected) and a large length value. Then when I call
ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr
to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my
side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks Jerry for the information,

I am doing the same, adding the offset to the virtual addr and also I am getting consisent value back from ScsiPortGetPhysicalAddress() equal to the calculated value.

But I am concerned whether this will work well on a 64 bit scenario (shouldn’t be an issue since it is virtually and physically contigous, need to test), where we may have an overflow to the Highpart when we add the offset to the physical addr. But the length that I get back from ScsiPortGetPhysicalAddress() is a strange high value. May be because of this (SrbExtension physical addr not valid), the commands are not correctly send out to the HBA (I am debugging the same).

Any thoughts on what may be going wrong? I read that ScsiPortGetPhysicalAddress() may sometimes give back inconsistent values.

Is there anyway I can specify alignment for SrbExtension buffer like in the case of AtaPort.

Thanks,
Sreekumar

IIRC ScsiPortGetVirtualAddress looked to see if the physical address was within the uncached extension range and if so computed the virtual address to return based on that. It should be entirely reliable since it’s simple arithmetic at that point.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 5:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SrbExtension Alignment

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual address whatever offset you added to the physical address to get the aligned address.

From a ScsiPort disassembly, I’m not sure I would trust ScsiPortGetVirtualAddress to work for addresses in the range of the SrbExtenaion. The StorPort function, on the other hand, calls (undocumented) MmGetVirtualFromPhysical.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com

06/19/2009 02:22 AM
Please respond to
“Windows System Software Devs Interest List”

To

“Windows System Software Devs Interest List”

cc

Subject

[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension buffer as a command table for the HBA, but the HBA spec has a restriction that this buffer’s physical address should be aligned on a 128 byte cache line.

I couldn’t find any place where I can tell the port to provide me a buffer with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the ScsiPortGetUncachedExtension(). I was planning to move ahead in the buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the physical address of the SrbExtension, I am getting a non-aligned addr (expected) and a large length value. Then when I call ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

Well, what if the physical address is not in the adapter’s Uncached
Extension but in the Srb Extension?

Looking at the disassembly of the ScsiPort version I only see a comparison
to one range. So unless that SrbExtensions are also allocated out of that
one range, the call passing in a physical address within the SrbExtension
will fail.

Peter Wieland
Sent by: xxxxx@lists.osr.com
06/19/2009 03:39 PM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE: [ntdev] SrbExtension Alignment

IIRC ScsiPortGetVirtualAddress looked to see if the physical address was
within the uncached extension range and if so computed the virtual address
to return based on that. It should be entirely reliable since it?s simple
arithmetic at that point.

-p

From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of
xxxxx@attotech.com
Sent: Friday, June 19, 2009 5:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SrbExtension Alignment

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual
address whatever offset you added to the physical address to get the
aligned address.

From a ScsiPort disassembly, I’m not sure I would trust
ScsiPortGetVirtualAddress to work for addresses in the range of the
SrbExtenaion. The StorPort function, on the other hand, calls
(undocumented) MmGetVirtualFromPhysical.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com
06/19/2009 02:22 AM

Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension
buffer as a command table for the HBA, but the HBA spec has a restriction
that this buffer’s physical address should be aligned on a 128 byte cache
line.

I couldn’t find any place where I can tell the port to provide me a buffer
with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both
HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling
the ScsiPortGetUncachedExtension(). I was planning to move ahead in the
buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the
physical address of the SrbExtension, I am getting a non-aligned addr
(expected) and a large length value. Then when I call
ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr
to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my
side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and
other seminars visit: http://www.osr.com/seminars To unsubscribe, visit
the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

SCSIPORT allocates one big piece of common buffer and creates the device’s uncached extension and the SRB extensions out of that single block of memory. So it can all be done with a single comparison.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 12:59 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] SrbExtension Alignment

Well, what if the physical address is not in the adapter’s Uncached Extension but in the Srb Extension?

Looking at the disassembly of the ScsiPort version I only see a comparison to one range. So unless that SrbExtensions are also allocated out of that one range, the call passing in a physical address within the SrbExtension will fail.

Peter Wieland
Sent by: xxxxx@lists.osr.com

06/19/2009 03:39 PM
Please respond to
“Windows System Software Devs Interest List”

To

“Windows System Software Devs Interest List”

cc

Subject

RE: [ntdev] SrbExtension Alignment

IIRC ScsiPortGetVirtualAddress looked to see if the physical address was within the uncached extension range and if so computed the virtual address to return based on that. It should be entirely reliable since it’s simple arithmetic at that point.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 5:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SrbExtension Alignment

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual address whatever offset you added to the physical address to get the aligned address.

From a ScsiPort disassembly, I’m not sure I would trust ScsiPortGetVirtualAddress to work for addresses in the range of the SrbExtenaion. The StorPort function, on the other hand, calls (undocumented) MmGetVirtualFromPhysical.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com

06/19/2009 02:22 AM

Please respond to
“Windows System Software Devs Interest List”

To

“Windows System Software Devs Interest List”

cc

Subject

[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension buffer as a command table for the HBA, but the HBA spec has a restriction that this buffer’s physical address should be aligned on a 128 byte cache line.

I couldn’t find any place where I can tell the port to provide me a buffer with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the ScsiPortGetUncachedExtension(). I was planning to move ahead in the buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the physical address of the SrbExtension, I am getting a non-aligned addr (expected) and a large length value. Then when I call ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I assume it also includes the SpecificLUExtension also? Don’t know if I need one, but I think it is nice StorPort makes it so easy in many ways. I will probably have to do a reverse port of a driver from StorPort to ScsiMiniport once I get it working. Generally opposite of what most people have to do since I started with StorPort. I sure wish the WDK documentation for StorPort would stop referring to the ScsiMiniport documentation. That is a disincentive to writing StorPort drivers along with the slow as molasses document viewer. Yes, I also have the CHM and use it some of the time.

“Peter Wieland” wrote in message news:xxxxx@ntdev…
SCSIPORT allocates one big piece of common buffer and creates the device’s uncached extension and the SRB extensions out of that single block of memory. So it can all be done with a single comparison.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 12:59 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] SrbExtension Alignment

Well, what if the physical address is not in the adapter’s Uncached Extension but in the Srb Extension?

Looking at the disassembly of the ScsiPort version I only see a comparison to one range. So unless that SrbExtensions are also allocated out of that one range, the call passing in a physical address within the SrbExtension will fail.

Peter Wieland
Sent by: xxxxx@lists.osr.com

06/19/2009 03:39 PM

Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”

cc

Subject
RE: [ntdev] SrbExtension Alignment

IIRC ScsiPortGetVirtualAddress looked to see if the physical address was within the uncached extension range and if so computed the virtual address to return based on that. It should be entirely reliable since it’s simple arithmetic at that point.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 5:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SrbExtension Alignment

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual address whatever offset you added to the physical address to get the aligned address.

From a ScsiPort disassembly, I’m not sure I would trust ScsiPortGetVirtualAddress to work for addresses in the range of the SrbExtenaion. The StorPort function, on the other hand, calls (undocumented) MmGetVirtualFromPhysical.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com

06/19/2009 02:22 AM

Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”

cc

Subject
[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension buffer as a command table for the HBA, but the HBA spec has a restriction that this buffer’s physical address should be aligned on a 128 byte cache line.

I couldn’t find any place where I can tell the port to provide me a buffer with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the ScsiPortGetUncachedExtension(). I was planning to move ahead in the buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the physical address of the SrbExtension, I am getting a non-aligned addr (expected) and a large length value. Then when I call ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

I don’t believe LU extensions are part of the uncached extension in SCSIPORT. Storport may have added that.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of David Craig
Sent: Friday, June 19, 2009 1:53 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] SrbExtension Alignment

I assume it also includes the SpecificLUExtension also? Don’t know if I need one, but I think it is nice StorPort makes it so easy in many ways. I will probably have to do a reverse port of a driver from StorPort to ScsiMiniport once I get it working. Generally opposite of what most people have to do since I started with StorPort. I sure wish the WDK documentation for StorPort would stop referring to the ScsiMiniport documentation. That is a disincentive to writing StorPort drivers along with the slow as molasses document viewer. Yes, I also have the CHM and use it some of the time.

“Peter Wieland” > wrote in message news:xxxxx@ntdev…
SCSIPORT allocates one big piece of common buffer and creates the device’s uncached extension and the SRB extensions out of that single block of memory. So it can all be done with a single comparison.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 12:59 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] SrbExtension Alignment

Well, what if the physical address is not in the adapter’s Uncached Extension but in the Srb Extension?

Looking at the disassembly of the ScsiPort version I only see a comparison to one range. So unless that SrbExtensions are also allocated out of that one range, the call passing in a physical address within the SrbExtension will fail.

Peter Wieland
Sent by: xxxxx@lists.osr.com

06/19/2009 03:39 PM
Please respond to
“Windows System Software Devs Interest List”

To

“Windows System Software Devs Interest List”

cc

Subject

RE: [ntdev] SrbExtension Alignment

IIRC ScsiPortGetVirtualAddress looked to see if the physical address was within the uncached extension range and if so computed the virtual address to return based on that. It should be entirely reliable since it’s simple arithmetic at that point.

-p

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@attotech.com
Sent: Friday, June 19, 2009 5:40 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] SrbExtension Alignment

Why are you calling ScsiPortGetVirtualAddress? Just add to the virtual address whatever offset you added to the physical address to get the aligned address.

From a ScsiPort disassembly, I’m not sure I would trust ScsiPortGetVirtualAddress to work for addresses in the range of the SrbExtenaion. The StorPort function, on the other hand, calls (undocumented) MmGetVirtualFromPhysical.
xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com

06/19/2009 02:22 AM

Please respond to
“Windows System Software Devs Interest List”

To

“Windows System Software Devs Interest List”

cc

Subject

[ntdev] SrbExtension Alignment

Hello,

I am developing a SCSIport miniport driver and I am using the SrbExtension buffer as a command table for the HBA, but the HBA spec has a restriction that this buffer’s physical address should be aligned on a 128 byte cache line.

I couldn’t find any place where I can tell the port to provide me a buffer with a required physical alignment.

So I tried giving more size to the SrbExtensionSize member of both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the ScsiPortGetUncachedExtension(). I was planning to move ahead in the buffer to find an offset with the required physical alignment.

But strangely, when I use the ScsiPortGetPhysicalAddress to get the physical address of the SrbExtension, I am getting a non-aligned addr (expected) and a large length value. Then when I call ScsiPortGetVirtualAddress to convert the offsetted aligned physical addr to virtual addr, its returning NULL.

Am I missing something simple or does this requires some redesign from my side? How do we normally specify alignment restrictions for SrbExtension?

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

— NTDEV is sponsored by OSR For our schedule of WDF, WDM, debugging and other seminars visit: http://www.osr.com/seminars To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

So I have now a couple of questions…

  1. Is there a way I can specify an alignment for SrbExtension buffer (physical) like in Ataport?

  2. If SrbExtension and Uncached ext are coming from a common buffer, why am I not getting a valid vaddr value when I call ScsiPortGetVirtualAddress()?, I have just added an offset to the phyaddr given back by ScsiPortGetPhysicalAddress().

  3. Why is the ScsiPortGetPhysicalAddress() returning an unusual large length value when I pass the SrbExtension Buffer? I have correctly passed the size of the SrbExtension buffer to both HW_INITIALIZATION_DATA and PORT_CONFIGURATION_INFORMATION before calling the
    ScsiPortGetUncachedExtension(). What may be going wrong here? Any clue.

  4. Out of curiousity, If SrbExt and Uncached extension are from a common large buffer (contigious?), then how will you decide the upper limit to the size of the buffer? I can pull requests and mark them busy and keep on pulling. So with all Srb, I should get a unique extension buffer, so in that case, is there any upper limits to the number of pulled requests marked pending/busy?

Thoughts on this will help me a lot. Otherwise, I will have to increase the size of the Uncached ext with size of the command table for all the slots of all the channels. This will add size of the command tables + alignment padding and will make the uncached ext big, which I do not prefer.

Thanks,
Sreekumar

The problem is resolved. I messed up the call to ScsiPortGetPhysicalAddress() by passing in Srb for getting back the SrbExtension phyaddr. As pointed out by Peter, SrbExtn seems to be part of the common buffer from which the port allocates the uncached ext. I don’t have to pass Srb param to ScsiPortGetPhysicalAddress(), it should be NULL. I have to pass it only for DataBuffer and SenseBuffer (missed it from msdn).

Now the SrbExtn is coming aligned.

The 4th query remains…
4. Out of curiousity, If SrbExt and Uncached extension are from a common large
buffer (contigious?), then how will you decide the upper limit to the size of
the buffer? I can pull requests and mark them busy and keep on pulling. So with
all Srb, I should get a unique extension buffer, so in that case, is there any
upper limits to the number of pulled requests marked pending/busy?

Can anyone share some information on this?

Thanks,
Sreekumar

  1. No.

  2. Don’t know. Hook up a debugger and step through the assembler code of
    ScsiPortGetPhysicalAddress. It’s really a very small function, less than
    20 instructions. If you can’t figure it out I’ll disassemble and comment
    it for you.

  3. It’s returning the length from the address you passed in to the end of
    that pool. That doesn’t mean you should do anything with the data beyond
    the object you are asking about. The function doesn’t know you are asking
    about the SrbExtension at this point - it just has a generic address you
    passed in and it doesn’t know anything about it - only whether it’s in the
    pool or not.

  4. Who is “you” in this context? YOU have specified the size of the
    SrbExtension yourself. You have asked for a pointer to it or something
    within it. It is YOUR responsibility to not mess with anything outside
    the range of the SrbExtension. Yes, there are limits as to how many SRBs
    can be in flight at any time. I don’t know what the default is, but you
    can adjust it with Parameters\Device\NumberOfRequests under your driver’s
    service key.

Jerry.

Oh, and thanks to PeterWieland for pointing out that ScsiPort puts all
this stuff into one big pool.

xxxxx@wipro.com
Sent by: xxxxx@lists.osr.com
06/22/2009 01:30 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
RE:[ntdev] SrbExtension Alignment

So I have now a couple of questions…

1. Is there a way I can specify an alignment for SrbExtension buffer
(physical) like in Ataport?

2. If SrbExtension and Uncached ext are coming from a common buffer, why
am I not getting a valid vaddr value when I call
ScsiPortGetVirtualAddress()?, I have just added an offset to the phyaddr
given back by ScsiPortGetPhysicalAddress().

3. Why is the ScsiPortGetPhysicalAddress() returning an unusual large
length value when I pass the SrbExtension Buffer? I have correctly passed
the size of the SrbExtension buffer to both HW_INITIALIZATION_DATA and
PORT_CONFIGURATION_INFORMATION before calling the
ScsiPortGetUncachedExtension(). What may be going wrong here? Any clue.

4. Out of curiousity, If SrbExt and Uncached extension are from a common
large buffer (contigious?), then how will you decide the upper limit to
the size of the buffer? I can pull requests and mark them busy and keep on
pulling. So with all Srb, I should get a unique extension buffer, so in
that case, is there any upper limits to the number of pulled requests
marked pending/busy?

Thoughts on this will help me a lot. Otherwise, I will have to increase
the size of the Uncached ext with size of the command table for all the
slots of all the channels. This will add size of the command tables +
alignment padding and will make the uncached ext big, which I do not
prefer.

Thanks,
Sreekumar


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

Thanks Jerry, that was really helpful.

I figured out what ScsiPortGetPhysicalAddress was doing and got the bug of sending Srb to get the SrbExtension phyaddr back.

Now I am getting a valid length back, not that this is equal to the SrbExtn size that I configured, but earlier I was getting a high junk value and this is also due to the bug of not passing NULL to ScsiPortGetPhysicalAddress() for Srb.

  1. With ‘YOU’, I meant the person who wrote the port. Sorry to confuse you :-). With ‘size of the buffer’, I meant the size of the common big buffer which Peter was mentioning.
    Thanks a lot for the information on Parameters\Device\NumberOfRequests. So the size of the common buffer is limited by (NumberOfRequests*SrbExtSize + Sizeof(uncached ext)).
    I may need this key to be adjusted.

Thank you.