PCI BARs mapping troubles under WinXP 64-bit

Hello.
I have a problem with access to HBA resources from HwScsiFindAdapter routine under Windows XP 64-bit. I’m just trying to use configuration information (for example, AccessRanges elements) supplied by the port driver. Both ScsiPortValidateRange() and ScsiPortGetDeviceBase() return with success and give me nonzero logical address that I use in ScsiPortReadRegisterBufferUchar(). ScsiPortReadRegisterBufferUchar() returns unexpected garbage. No page faults or other errors occur, but wrong data.
Note that the same code gave me correct data under 32-bit environment. What is wrong here with switching to 64-bits environment?

Thanks in advance.

Alex.


Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Meet Singles
http://corp.mail.com/lavalife

Why use ScsiPortValidateRange if the access ranges are already found
and provided to you by the port?

ScsiPortValidateRange is only for the case if the port passed zero
access ranges, which means - the miniport must scan for its hardware
itself by probing. ScsiPortValidateRange (which is IIRC mapped to
IoReportResourceForDetection) is only for this probing, to avoid
probing the address which is already occupied by some other device,
since such a situation can break the state of the other device and
hang the machine.

Max

----- Original Message -----
From: "Alex "
To: “NT Developers Interest List”
Sent: Saturday, January 04, 2003 5:42 PM
Subject: [ntdev] PCI BARs mapping troubles under WinXP 64-bit

> Hello.
> I have a problem with access to HBA resources from HwScsiFindAdapter
routine under Windows XP 64-bit. I’m just trying to use configuration
information (for example, AccessRanges elements) supplied by the port
driver. Both ScsiPortValidateRange() and ScsiPortGetDeviceBase()
return with success and give me nonzero logical address that I use in
ScsiPortReadRegisterBufferUchar(). ScsiPortReadRegisterBufferUchar()
returns unexpected garbage. No page faults or other errors occur, but
wrong data.
> Note that the same code gave me correct data under 32-bit
environment. What is wrong here with switching to 64-bits environment?
>
> Thanks in advance.
>
> Alex.
> –
> _______________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
>
> Meet Singles
> http://corp.mail.com/lavalife
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>

Looks to me like ScsiPortValidateRange is a NOP on 32-bit Win2K:

6: kd> u scsiport!ScsiPortValidateRange
SCSIPORT!ScsiPortValidateRange:
bff48ab8 b001 mov al,0x1
bff48aba c21c00 ret 0x1c

Obviously XP could be different but I think that’s unlikely (should be easy
for you to check though).

Perhaps you are storing only the bottom 32-bits of the address returned by
ScsiPortGetDeviceBase; that would be classic 32-to-64 bit issue…

/simgr

-----Original Message-----
From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
Sent: Saturday, January 04, 2003 11:39 AM
To: NT Developers Interest List
Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit

Why use ScsiPortValidateRange if the access ranges are already found
and provided to you by the port?

ScsiPortValidateRange is only for the case if the port passed zero
access ranges, which means - the miniport must scan for its hardware
itself by probing. ScsiPortValidateRange (which is IIRC mapped to
IoReportResourceForDetection) is only for this probing, to avoid
probing the address which is already occupied by some other device,
since such a situation can break the state of the other device and
hang the machine.

Max

----- Original Message -----
From: "Alex "
To: “NT Developers Interest List”
Sent: Saturday, January 04, 2003 5:42 PM
Subject: [ntdev] PCI BARs mapping troubles under WinXP 64-bit

> Hello.
> I have a problem with access to HBA resources from HwScsiFindAdapter
routine under Windows XP 64-bit. I’m just trying to use configuration
information (for example, AccessRanges elements) supplied by the port
driver. Both ScsiPortValidateRange() and ScsiPortGetDeviceBase()
return with success and give me nonzero logical address that I use in
ScsiPortReadRegisterBufferUchar(). ScsiPortReadRegisterBufferUchar()
returns unexpected garbage. No page faults or other errors occur, but
wrong data.
> Note that the same code gave me correct data under 32-bit
environment. What is wrong here with switching to 64-bits environment?
>
> Thanks in advance.
>
> Alex.
> –
> _______________________________________________
> Sign-up for your own FREE Personalized E-mail at Mail.com
> http://www.mail.com/?sr=signup
>
> Meet Singles
> http://corp.mail.com/lavalife
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


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

Thanks, but anyway redundant using of ScsiPortValidateRange() doesn’t lead to the problem described. And I use PULONG_PTR type (unsigned __int64) to store the address returned by ScsiPortGetDeviceBase().

Please write if you have another ideas.

Alex

----- Original Message -----
From: “Graham, Simon”
Date: Sat, 4 Jan 2003 13:13:20 -0500
To: “NT Developers Interest List”
Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit

> Looks to me like ScsiPortValidateRange is a NOP on 32-bit Win2K:
>
> 6: kd> u scsiport!ScsiPortValidateRange
> SCSIPORT!ScsiPortValidateRange:
> bff48ab8 b001 mov al,0x1
> bff48aba c21c00 ret 0x1c
>
> Obviously XP could be different but I think that’s unlikely (should be easy
> for you to check though).
>
> Perhaps you are storing only the bottom 32-bits of the address returned by
> ScsiPortGetDeviceBase; that would be classic 32-to-64 bit issue…
>
> /simgr
>
> -----Original Message-----
> From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
> Sent: Saturday, January 04, 2003 11:39 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit
>
>
> Why use ScsiPortValidateRange if the access ranges are already found
> and provided to you by the port?
>
> ScsiPortValidateRange is only for the case if the port passed zero
> access ranges, which means - the miniport must scan for its hardware
> itself by probing. ScsiPortValidateRange (which is IIRC mapped to
> IoReportResourceForDetection) is only for this probing, to avoid
> probing the address which is already occupied by some other device,
> since such a situation can break the state of the other device and
> hang the machine.
>
> Max
>
> ----- Original Message -----
> From: "Alex "
> To: “NT Developers Interest List”
> Sent: Saturday, January 04, 2003 5:42 PM
> Subject: [ntdev] PCI BARs mapping troubles under WinXP 64-bit
>
>
> > Hello.
> > I have a problem with access to HBA resources from HwScsiFindAdapter
> routine under Windows XP 64-bit. I’m just trying to use configuration
> information (for example, AccessRanges elements) supplied by the port
> driver. Both ScsiPortValidateRange() and ScsiPortGetDeviceBase()
> return with success and give me nonzero logical address that I use in
> ScsiPortReadRegisterBufferUchar(). ScsiPortReadRegisterBufferUchar()
> returns unexpected garbage. No page faults or other errors occur, but
> wrong data.
> > Note that the same code gave me correct data under 32-bit
> environment. What is wrong here with switching to 64-bits environment?
> >
> > Thanks in advance.
> >
> > Alex.
> > –
> >
> > Sign-up for your own FREE Personalized E-mail at Mail.com
> > http://www.mail.com/?sr=signup
> >
> > Meet Singles
> > http://corp.mail.com/lavalife
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@email.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>



Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Meet Singles
http://corp.mail.com/lavalife

I’m not particularly up on ia64 debugging but a couple of things I would do
with the debugger are:

. Check that the returned address really does map to the BAR - !pte
should show you
the mapping to physical and that the full address really is stored in your
data structure
and is still there at the time of the call to read from it.

. You could try doing the read from windbg - unfortunately, this may not
work (or may
unexpectedly work) because windbg ALWAYS does 32-bit reads and you appear
to be using
an 8-bit read. Try both dd and !dd .

/simgr

-----Original Message-----
From: Alex [mailto:xxxxx@email.com]
Sent: Sunday, January 05, 2003 4:10 AM
To: NT Developers Interest List
Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit

Thanks, but anyway redundant using of ScsiPortValidateRange() doesn’t lead
to the problem described. And I use PULONG_PTR type (unsigned int64) to
store the address returned by ScsiPortGetDeviceBase().

Please write if you have another ideas.

Alex

----- Original Message -----
From: “Graham, Simon”
Date: Sat, 4 Jan 2003 13:13:20 -0500
To: “NT Developers Interest List”
Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit

> Looks to me like ScsiPortValidateRange is a NOP on 32-bit Win2K:
>
> 6: kd> u scsiport!ScsiPortValidateRange
> SCSIPORT!ScsiPortValidateRange:
> bff48ab8 b001 mov al,0x1
> bff48aba c21c00 ret 0x1c
>
> Obviously XP could be different but I think that’s unlikely (should be
easy
> for you to check though).
>
> Perhaps you are storing only the bottom 32-bits of the address returned by
> ScsiPortGetDeviceBase; that would be classic 32-to-64 bit issue…
>
> /simgr
>
> -----Original Message-----
> From: Maxim S. Shatskih [mailto:xxxxx@storagecraft.com]
> Sent: Saturday, January 04, 2003 11:39 AM
> To: NT Developers Interest List
> Subject: [ntdev] Re: PCI BARs mapping troubles under WinXP 64-bit
>
>
> Why use ScsiPortValidateRange if the access ranges are already found
> and provided to you by the port?
>
> ScsiPortValidateRange is only for the case if the port passed zero
> access ranges, which means - the miniport must scan for its hardware
> itself by probing. ScsiPortValidateRange (which is IIRC mapped to
> IoReportResourceForDetection) is only for this probing, to avoid
> probing the address which is already occupied by some other device,
> since such a situation can break the state of the other device and
> hang the machine.
>
> Max
>
> ----- Original Message -----
> From: "Alex "
> To: “NT Developers Interest List”
> Sent: Saturday, January 04, 2003 5:42 PM
> Subject: [ntdev] PCI BARs mapping troubles under WinXP 64-bit
>
>
> > Hello.
> > I have a problem with access to HBA resources from HwScsiFindAdapter
> routine under Windows XP 64-bit. I’m just trying to use configuration
> information (for example, AccessRanges elements) supplied by the port
> driver. Both ScsiPortValidateRange() and ScsiPortGetDeviceBase()
> return with success and give me nonzero logical address that I use in
> ScsiPortReadRegisterBufferUchar(). ScsiPortReadRegisterBufferUchar()
> returns unexpected garbage. No page faults or other errors occur, but
> wrong data.
> > Note that the same code gave me correct data under 32-bit
> environment. What is wrong here with switching to 64-bits environment?
> >
> > Thanks in advance.
> >
> > Alex.
> > –
> >
_____________________________________________
> > Sign-up for your own FREE Personalized E-mail at Mail.com
> > http://www.mail.com/?sr=signup
> >
> > Meet Singles
> > http://corp.mail.com/lavalife
> >
> >
> >
> > —
> > You are currently subscribed to ntdev as: xxxxx@storagecraft.com
> > To unsubscribe send a blank email to xxxxx@lists.osr.com
> >
>
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@stratus.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>
> —
> You are currently subscribed to ntdev as: xxxxx@email.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com
>


_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

Meet Singles
http://corp.mail.com/lavalife


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