Update PCI BAR

Hi,

I write a PCI driver for Windows XP and to work correctly, I need to update PCI BAR in the PCI_COMMON_CONFIG.

To do that, I send an IRP_MN_READ_CONFIG to fill my structure, that works well (I check some information to be sure it was filled correctly).
Then, I modify my BaseAdresses[3, 4 and 5] and send an IRP_MN_WRITE_CONFIG with my updated structure.

My problem is that when I re-read (IRP_MN_READ_CONFIG) the data, no update has happened on this base adresses.

How could I forces the updates on this fileds ?

Thanks.
Guillaume

xxxxx@lyon.medianesysteme.com wrote:

Hi,

I write a PCI driver for Windows XP and to work correctly, I need to update PCI BAR in the PCI_COMMON_CONFIG.

To do that, I send an IRP_MN_READ_CONFIG to fill my structure, that works well (I check some information to be sure it was filled correctly).
Then, I modify my BaseAdresses[3, 4 and 5] and send an IRP_MN_WRITE_CONFIG with my updated structure.

My problem is that when I re-read (IRP_MN_READ_CONFIG) the data, no update has happened on this base adresses.

How could I forces the updates on this fileds ?

Generally speaking you can’t do this. Why on earth do you think you need
to reprogram your configuration?

Thanks.
Guillaume


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] + 0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] + 0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] + 0x30000;

I don’t say it is the “correct” way, but it is the way the card is developped.
It is the card which need this reconfiguration.

Guillaume

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de Mark Roddy
Envoyé : vendredi 13 juillet 2007 15:18
À : Windows System Software Devs Interest List
Objet : Re: [ntdev] Update PCI BAR

xxxxx@lyon.medianesysteme.com wrote:

Hi,

I write a PCI driver for Windows XP and to work correctly, I need to update PCI BAR in the PCI_COMMON_CONFIG.

To do that, I send an IRP_MN_READ_CONFIG to fill my structure, that works well (I check some information to be sure it was filled correctly).
Then, I modify my BaseAdresses[3, 4 and 5] and send an IRP_MN_WRITE_CONFIG with my updated structure.

My problem is that when I re-read (IRP_MN_READ_CONFIG) the data, no update has happened on this base adresses.

How could I forces the updates on this fileds ?

Generally speaking you can’t do this. Why on earth do you think you need
to reprogram your configuration?

Thanks.
Guillaume


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

Guillaume DALENS wrote:

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] + 0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] + 0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] + 0x30000;

I don’t say it is the “correct” way, but it is the way the card is developped.
It is the card which need this reconfiguration.

Why do you think you have access to those addresses? Suppose that they
are allocated to some other PCI device?
Anyway, your hardware is broken and non-compliant. The bars need to use
the normal PCI mandated configuration process. I think the answer is
that this device is not compatible with current Windows platforms. Sorry.

Guillaume

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de Mark Roddy
Envoyé : vendredi 13 juillet 2007 15:18
À : Windows System Software Devs Interest List
Objet : Re: [ntdev] Update PCI BAR

xxxxx@lyon.medianesysteme.com wrote:

> Hi,
>
> I write a PCI driver for Windows XP and to work correctly, I need to update PCI BAR in the PCI_COMMON_CONFIG.
>
> To do that, I send an IRP_MN_READ_CONFIG to fill my structure, that works well (I check some information to be sure it was filled correctly).
> Then, I modify my BaseAdresses[3, 4 and 5] and send an IRP_MN_WRITE_CONFIG with my updated structure.
>
> My problem is that when I re-read (IRP_MN_READ_CONFIG) the data, no update has happened on this base adresses.
>
> How could I forces the updates on this fileds ?
>
>
>
Generally speaking you can’t do this. Why on earth do you think you need
to reprogram your configuration?

> Thanks.
> Guillaume
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

I think I need to access those addresses because it is what is done in the old NT driver.

I’m afraid you’re right. I think I will re-use the old Hal… Function.
Thanks for the answer, it confirm my fear.
Guillaume

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de Mark Roddy
Envoyé : vendredi 13 juillet 2007 16:55
À : Windows System Software Devs Interest List
Objet : Re: [ntdev] Update PCI BAR

Guillaume DALENS wrote:

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] + 0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] + 0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] + 0x30000;

I don’t say it is the “correct” way, but it is the way the card is developped.
It is the card which need this reconfiguration.

Why do you think you have access to those addresses? Suppose that they
are allocated to some other PCI device?
Anyway, your hardware is broken and non-compliant. The bars need to use
the normal PCI mandated configuration process. I think the answer is
that this device is not compatible with current Windows platforms. Sorry.

Guillaume

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de Mark Roddy
Envoyé : vendredi 13 juillet 2007 15:18
À : Windows System Software Devs Interest List
Objet : Re: [ntdev] Update PCI BAR

xxxxx@lyon.medianesysteme.com wrote:

> Hi,
>
> I write a PCI driver for Windows XP and to work correctly, I need to update PCI BAR in the PCI_COMMON_CONFIG.
>
> To do that, I send an IRP_MN_READ_CONFIG to fill my structure, that works well (I check some information to be sure it was filled correctly).
> Then, I modify my BaseAdresses[3, 4 and 5] and send an IRP_MN_WRITE_CONFIG with my updated structure.
>
> My problem is that when I re-read (IRP_MN_READ_CONFIG) the data, no update has happened on this base adresses.
>
> How could I forces the updates on this fileds ?
>
>
>
Generally speaking you can’t do this. Why on earth do you think you need
to reprogram your configuration?

> Thanks.
> Guillaume
>
>
> —
> Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
>


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at http://www.osronline.com/article.cfm?id=256

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

He has access because they’ve been allocated with base address
…BaseAddresses[2].
If he could re-distribute this address range across the other BADR’s as
stated he should be ok, no? Not that it’s a good idea from the start, but
that’s not the issue at this point.

> // PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
> PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] +
> 0x10000;
> PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] +
> 0x20000;
> PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] +
> 0x30000;
>
>I don’t say it is the “correct” way, but it is the way the card is
>developped.
>It is the card which need this reconfiguration.
>
>

Why do you think you have access to those addresses? Suppose that they are
allocated to some other PCI device?

Out of curiosity, what should happen after you manually reconfigure the
BARs? Do you have some other driver (or user level application) on top of
you that will read these BARs? Is it the hardware itself that uses the new
BARs?

Have a nice day
GV


Gianluca Varenni, Windows DDK MVP

CACE Technologies
http://www.cacetech.com

----- Original Message -----
From: “Justin Schoenwald”
To: “Windows System Software Devs Interest List”
Sent: Friday, July 13, 2007 9:20 AM
Subject: Re: [ntdev] Update PCI BAR

> He has access because they’ve been allocated with base address
> …BaseAddresses[2].
> If he could re-distribute this address range across the other BADR’s as
> stated he should be ok, no? Not that it’s a good idea from the start, but
> that’s not the issue at this point.
>
>>> // PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
>>> PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] +
>>> 0x10000;
>>> PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] +
>>> 0x20000;
>>> PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] +
>>> 0x30000;
>>>
>>>I don’t say it is the “correct” way, but it is the way the card is
>>>developped.
>>>It is the card which need this reconfiguration.
>>>
>>>
>>
>>Why do you think you have access to those addresses? Suppose that they are
>>allocated to some other PCI device?
>
>
>
>
> —
> Questions? First check the Kernel Driver FAQ at
> http://www.osronline.com/article.cfm?id=256
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer

Ah, I missed that. Ok, so he owns these addresses however if I recall
correctly the config space access methods exposed by windows do not let
you write to the bars. I could have misremembered that too.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Justin Schoenwald
Sent: Friday, July 13, 2007 12:21 PM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] Update PCI BAR

He has access because they’ve been allocated with base address
…BaseAddresses[2].
If he could re-distribute this address range across the other BADR’s as
stated he should be ok, no? Not that it’s a good idea from the start,
but
that’s not the issue at this point.

> // PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
> PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] +
> 0x10000;
> PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] +
> 0x20000;
> PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] +
> 0x30000;
>
>I don’t say it is the “correct” way, but it is the way the card is
>developped.
>It is the card which need this reconfiguration.
>
>

Why do you think you have access to those addresses? Suppose that they
are
allocated to some other PCI device?


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

On Fri, Jul 13, 2007 at 04:19:47PM +0200, Guillaume DALENS wrote:

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] + 0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] + 0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] + 0x30000;

I don’t say it is the “correct” way, but it is the way the card is developped.
It is the card which need this reconfiguration.

I suspect there is a rather large misunderstanding here. If the board
needs 4 0x10000-byte memory BARs, then any hardware designer that wasn’t
a drooling idiot would have created the configuration space with 4 BARs
of 0x10000 bytes each, and in that case the BIOS would do exactly what
you are doing.

Now, if your driver wants to treat the 0x40000-byte BAR as four separate
regions of 0x10000 bytes, that’s perfectly normal, and doesn’t require any
hardware trickery at all. But if your hardware really needs you to rewrite
the BARs in its configuration space, then let me ask you what is stored in
those BARs at reset time? Do they come up as unused? Do they come up
needing a memory region?

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

Hi,

Thanks for answer. Back from week-end, I 'll try to answer all remarks.

The PCI bar’s configuration is not just a software/driver used.
What I understand from the old-driver is that this reconfiguration allows
the PLX
to redirect addresses : base+10000 redirect on reset pin, base+30000
redirect on
watchdog activation pin…
What happen at reset time is still dark… I think I will need to
reinitialize it.

I think this kind of process should effectively be done on hardware design,
but this is an old card, and I need to do it myself.

The old driver used the obsolete HalGetBusData/HalSetBusData and it woks on
W2K.

Is anyone can confirm me that this re-configuration is not possible anymore
with WXP ?
It will short my project.

Guillaume Dalens

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de xxxxx@probo.com
Envoye : vendredi 13 juillet 2007 22:37
A : Windows System Software Devs Interest List
Cc : Tim Roberts
Objet : Re: [ntdev] Update PCI BAR

On Fri, Jul 13, 2007 at 04:19:47PM +0200, Guillaume DALENS wrote:

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this
operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] +
0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] +
0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] +
0x30000;

I don’t say it is the “correct” way, but it is the way the card is
developped.
It is the card which need this reconfiguration.

I suspect there is a rather large misunderstanding here. If the board
needs 4 0x10000-byte memory BARs, then any hardware designer that wasn’t
a drooling idiot would have created the configuration space with 4 BARs
of 0x10000 bytes each, and in that case the BIOS would do exactly what
you are doing.

Now, if your driver wants to treat the 0x40000-byte BAR as four separate
regions of 0x10000 bytes, that’s perfectly normal, and doesn’t require any
hardware trickery at all. But if your hardware really needs you to rewrite
the BARs in its configuration space, then let me ask you what is stored in
those BARs at reset time? Do they come up as unused? Do they come up
needing a memory region?

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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

It sounds like Tim’s first option: the firmware designer was a drooling
idiot, applies. But it is only firmware, right? Perhaps you should
consider having the firmware modified.

While they are deprecated (use is discouraged) you can still use
HalGet/SetBusData. You will have to map the associated resources
yourself without help from PnP, and there is no guarantee that these
routines will a) work b) allow you to write the bar config space. It
should be easy enough to try them and see what happens. You should be
able to resolve this issue one way or another in a day or so.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Guillaume DALENS
Sent: Monday, July 16, 2007 3:26 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] Update PCI BAR

Hi,

Thanks for answer. Back from week-end, I 'll try to answer all remarks.

The PCI bar’s configuration is not just a software/driver used.
What I understand from the old-driver is that this reconfiguration
allows
the PLX
to redirect addresses : base+10000 redirect on reset pin, base+30000
redirect on
watchdog activation pin…
What happen at reset time is still dark… I think I will need to
reinitialize it.

I think this kind of process should effectively be done on hardware
design,
but this is an old card, and I need to do it myself.

The old driver used the obsolete HalGetBusData/HalSetBusData and it woks
on
W2K.

Is anyone can confirm me that this re-configuration is not possible
anymore
with WXP ?
It will short my project.

Guillaume Dalens

-----Message d’origine-----
De : xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]De la part de xxxxx@probo.com
Envoye : vendredi 13 juillet 2007 22:37
A : Windows System Software Devs Interest List
Cc : Tim Roberts
Objet : Re: [ntdev] Update PCI BAR

On Fri, Jul 13, 2007 at 04:19:47PM +0200, Guillaume DALENS wrote:

Hello

I know it is not a correct way but…

I make evolve a NT driver into a WDM driver for a card. I need this
operation :

// PciData.u.type.BaseAddresses[2] is a 0x40000 sized memory range
PciData.u.type.BaseAddresses[3] = PciData.u.type.BaseAddresses[2] +
0x10000;
PciData.u.type.BaseAddresses[4] = PciData.u.type.BaseAddresses[2] +
0x20000;
PciData.u.type.BaseAddresses[5] = PciData.u.type.BaseAddresses[2] +
0x30000;

I don’t say it is the “correct” way, but it is the way the card is
developped.
It is the card which need this reconfiguration.

I suspect there is a rather large misunderstanding here. If the board
needs 4 0x10000-byte memory BARs, then any hardware designer that wasn’t
a drooling idiot would have created the configuration space with 4 BARs
of 0x10000 bytes each, and in that case the BIOS would do exactly what
you are doing.

Now, if your driver wants to treat the 0x40000-byte BAR as four separate
regions of 0x10000 bytes, that’s perfectly normal, and doesn’t require
any
hardware trickery at all. But if your hardware really needs you to
rewrite
the BARs in its configuration space, then let me ask you what is stored
in
those BARs at reset time? Do they come up as unused? Do they come up
needing a memory region?

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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


Questions? First check the Kernel Driver FAQ at
http://www.osronline.com/article.cfm?id=256

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