IRP_MN_QUERY_RESOURCES

Hi all,
I was just reading the DDK docs when I stuck in PNP minor IRPs. I have
a question, when a bus function driver reports the arrival of a new device
to PnP manager. It sends a number of PNP minor IRPs to the PDO of the new
device out of which one is IRP_MN_QUERY_RESOURCES. According to the docs,
these resources are for booting the devcie. But, I do not understand where
and when these resources are assigned to either PDO or FDO of the device and
by which IRP.
IRP_MN_QUERY_RESOURCE_REQUIREMENTS is used for querying device resources
and the device got those resources assigned through IRP_MN_START_DEVICE.

Thank you.

> when a bus function driver reports…

What is " bus function driver"??? Are you speaking about a bus driver or about a function one???

a bus function driver reports the arrival of a new device to PnP manager.
It sends a number of PNP minor IRPs to the PDO of the new device out of which
one is IRP_MN_QUERY_RESOURCES. According to the docs, these resources
are for booting the devcie. But, I do not understand where and when these
resources are assigned to either PDO or FDO of the device and by which IRP.

In order to get a device’s boot configuration resources, PnP manager sends IRP_MN_QUERY_RESOURCES to PDO. In response to this request, bus driver obtains the sought info from the device, and returns configuration resources in CM_RESOURCE_LIST.
The way bus driver obtains these resources depends on the bus. For example, PCI bus driver
can obtain this info via configuration space, i.e. ports 0xCF8 and 0xCFC - it can write bus, function and device number, as well as offset on the sought parameter to IO port 0xCF8, and get the sought information from port 0xCFC ( for more detailed info on the topic read “PCI specifications” ). After having obtained all required info, it allocates CM_RESOURCE_LIST, and returns. When IRP_MN_START_DEVICE gets sent to the target device, a function driver that attached its FDO to device’s PDO will use this list in order to do all required stuff
(map device into memory, connect interrupt,etc)…

Anton Bassov

On 1/21/08, xxxxx@hotmail.com wrote:
> > when a bus function driver reports…
>
> What is " bus function driver"??? Are you speaking about a bus driver or
> about a function one???
>

I mean bus device FDO

>
> > a bus function driver reports the arrival of a new device to PnP manager.
> > It sends a number of PNP minor IRPs to the PDO of the new device out of
> which
> > one is IRP_MN_QUERY_RESOURCES. According to the docs, these resources
> > are for booting the devcie. But, I do not understand where and when these
> > resources are assigned to either PDO or FDO of the device and by which
> IRP.
>
> In order to get a device’s boot configuration resources, PnP manager sends
> IRP_MN_QUERY_RESOURCES to PDO. In response to this request, bus driver
> obtains the sought info from the device, and returns configuration resources
> in CM_RESOURCE_LIST.
> The way bus driver obtains these resources depends on the bus. For example,
> PCI bus driver
> can obtain this info via configuration space, i.e. ports 0xCF8 and 0xCFC -
> it can write bus, function and device number, as well as offset on the
> sought parameter to IO port 0xCF8, and get the sought information from port
> 0xCFC ( for more detailed info on the topic read “PCI specifications” ).
> After having obtained all required info, it allocates CM_RESOURCE_LIST,
> and returns. When IRP_MN_START_DEVICE gets sent to the target device, a
> function driver that attached its FDO to device’s PDO will use this list in
> order to do all required stuff
> (map device into memory, connect interrupt,etc)…
>
>

Still not clear. If resources passed to IRP_MN_START_DEVICE were
those from IRP_MN_QUERY_RESOURCES, then why the PnP manager issues
IRP_MN_QUERY_DEVICE_RESOURCES to device PDO and
IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device FDO.
I am confused over here. Which resources are passed to
IRP_MN_START_DEVICE, one that is allocated from IRP_MN_QUERY_RESOURCES
or from IRP_MN_QUERY_DEVICE_RESOURCES.

Thank you.

On Jan 21, 2008 2:19 AM, salman razzaq wrote:
> >
>
> Still not clear. If resources passed to IRP_MN_START_DEVICE were
> those from IRP_MN_QUERY_RESOURCES, then why the PnP manager issues
> IRP_MN_QUERY_DEVICE_RESOURCES to device PDO and
> IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device FDO.
> I am confused over here. Which resources are passed to
> IRP_MN_START_DEVICE, one that is allocated from IRP_MN_QUERY_RESOURCES
> or from IRP_MN_QUERY_DEVICE_RESOURCES.
>

Pnp issues IRP_MN_QUERY_RESOURCES and
IRP_MN_QUERY_RESOURCE_REQUIREMENTS first, prior to start device. One
returns a list of ‘boot resources’, the other a more complicated list
of alternative resources, each in slightly different formats. The
resources passed to IRP_MN_START_DEVICE are determined from those two
prior IRPs. In practice the two resource IRPs pass back the same data
except if the device is a legacy ISA device. Unless you are writing a
bus driver for a real IO bus, or if you have some unusual
multifunction requirement that has forced you to implement a pseudo
bus for a real IO bus, you generally do not care about the resource
IRPs.


Mark Roddy

To make things a little more murky, these pnp irps are not the only interfaces required to hand out hw resources to devices. The other required interfaces are not documented and change from OS to OS which means that you cannot write a replacement for pci.sys or isapnp.sys using only the pnp irps

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, January 21, 2008 4:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MN_QUERY_RESOURCES

On Jan 21, 2008 2:19 AM, salman razzaq wrote:
> >
>
> Still not clear. If resources passed to IRP_MN_START_DEVICE were
> those from IRP_MN_QUERY_RESOURCES, then why the PnP manager issues
> IRP_MN_QUERY_DEVICE_RESOURCES to device PDO and
> IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device FDO.
> I am confused over here. Which resources are passed to
> IRP_MN_START_DEVICE, one that is allocated from IRP_MN_QUERY_RESOURCES
> or from IRP_MN_QUERY_DEVICE_RESOURCES.
>

Pnp issues IRP_MN_QUERY_RESOURCES and
IRP_MN_QUERY_RESOURCE_REQUIREMENTS first, prior to start device. One
returns a list of ‘boot resources’, the other a more complicated list
of alternative resources, each in slightly different formats. The
resources passed to IRP_MN_START_DEVICE are determined from those two
prior IRPs. In practice the two resource IRPs pass back the same data
except if the device is a legacy ISA device. Unless you are writing a
bus driver for a real IO bus, or if you have some unusual
multifunction requirement that has forced you to implement a pseudo
bus for a real IO bus, you generally do not care about the resource
IRPs.


Mark Roddy


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 can’t figure out if the OP is in ‘learning how things work mode’, or
actually has some real development need to understand what is going on
inside PnP.

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Doron Holan
Sent: Monday, January 21, 2008 11:14 AM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] IRP_MN_QUERY_RESOURCES

To make things a little more murky, these pnp irps are not the only
interfaces required to hand out hw resources to devices. The other
required interfaces are not documented and change from OS to OS which
means that you cannot write a replacement for pci.sys or isapnp.sys
using only the pnp irps

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, January 21, 2008 4:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MN_QUERY_RESOURCES

On Jan 21, 2008 2:19 AM, salman razzaq wrote:
> >
>
> Still not clear. If resources passed to IRP_MN_START_DEVICE were
> those from IRP_MN_QUERY_RESOURCES, then why the PnP manager issues
> IRP_MN_QUERY_DEVICE_RESOURCES to device PDO and
> IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device FDO.
> I am confused over here. Which resources are passed to
> IRP_MN_START_DEVICE, one that is allocated from IRP_MN_QUERY_RESOURCES
> or from IRP_MN_QUERY_DEVICE_RESOURCES.
>

Pnp issues IRP_MN_QUERY_RESOURCES and
IRP_MN_QUERY_RESOURCE_REQUIREMENTS first, prior to start device. One
returns a list of ‘boot resources’, the other a more complicated list
of alternative resources, each in slightly different formats. The
resources passed to IRP_MN_START_DEVICE are determined from those two
prior IRPs. In practice the two resource IRPs pass back the same data
except if the device is a legacy ISA device. Unless you are writing a
bus driver for a real IO bus, or if you have some unusual
multifunction requirement that has forced you to implement a pseudo
bus for a real IO bus, you generally do not care about the resource
IRPs.


Mark Roddy


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

Why is that exactly? I thought a big selling point of the bus driver model
was to alleviate the need for companies like Compaq et al from having to
write custom HALs. Sounds like not really. Was there a reason for not
using the model for PCI and such? Just curious.

Bill M.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
To make things a little more murky, these pnp irps are not the only
interfaces required to hand out hw resources to devices. The other required
interfaces are not documented and change from OS to OS which means that you
cannot write a replacement for pci.sys or isapnp.sys using only the pnp irps

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Mark Roddy
Sent: Monday, January 21, 2008 4:13 AM
To: Windows System Software Devs Interest List
Subject: Re: [ntdev] IRP_MN_QUERY_RESOURCES

On Jan 21, 2008 2:19 AM, salman razzaq wrote:
> >
>
> Still not clear. If resources passed to IRP_MN_START_DEVICE were
> those from IRP_MN_QUERY_RESOURCES, then why the PnP manager issues
> IRP_MN_QUERY_DEVICE_RESOURCES to device PDO and
> IRP_MN_FILTER_RESOURCE_REQUIREMENTS to device FDO.
> I am confused over here. Which resources are passed to
> IRP_MN_START_DEVICE, one that is allocated from IRP_MN_QUERY_RESOURCES
> or from IRP_MN_QUERY_DEVICE_RESOURCES.
>

Pnp issues IRP_MN_QUERY_RESOURCES and
IRP_MN_QUERY_RESOURCE_REQUIREMENTS first, prior to start device. One
returns a list of ‘boot resources’, the other a more complicated list
of alternative resources, each in slightly different formats. The
resources passed to IRP_MN_START_DEVICE are determined from those two
prior IRPs. In practice the two resource IRPs pass back the same data
except if the device is a legacy ISA device. Unless you are writing a
bus driver for a real IO bus, or if you have some unusual
multifunction requirement that has forced you to implement a pseudo
bus for a real IO bus, you generally do not care about the resource
IRPs.


Mark Roddy


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

IRP_MN_QUERY_RESOURCES is equivalent to "What resources is the device
decoding right now?

IRP_MN_QUERY_RESOURCE_REQUIREMENTS is equivalent to “What is the set
of possible sets of resources that this device could use?”

The first is useful for making sure that the PnP manager doesn’t
accidentally create resource conflicts between an early-starting
driver and a later-starting driver. Since it knows what resources the
later-starting device is using, it can choose other values for the
early-starting devices.

The second is useful for choosing possible configurations when
starting a device.

  • Jake Oshins

“salman razzaq” wrote in message
news:xxxxx@ntdev…
Hi all,
I was just reading the DDK docs when I stuck in PNP minor IRPs. I
have a question, when a bus function driver reports the arrival of a
new device to PnP manager. It sends a number of PNP minor IRPs to the
PDO of the new device out of which one is IRP_MN_QUERY_RESOURCES.
According to the docs, these resources are for booting the devcie.
But, I do not understand where and when these resources are assigned
to either PDO or FDO of the device and by which IRP.
IRP_MN_QUERY_RESOURCE_REQUIREMENTS is used for querying device
resources and the device got those resources assigned through
IRP_MN_START_DEVICE.

Thank you.

> Was there a reason for not using the model for PCI and such?

I have my own theory about it…

I think the point of the whole exercise is to make sure that no one provides his own version of PCI.SYS. Imagine the scenario when some device vendor wants to apply some “optimizations” to PCI bus driver in order to make everything work in a way that is most suitable for the device in question (for example, they may want to make sure some certain pre-defined resources are assigned to it). Although this way way be most suitable one for the device in question, it may be not-so-suitable for all other devices on the bus, especially if this custom bus driver is not-so-well implemented. Now imagine that vendors of more than one device on the target machine want to do it. You would not really want to be in the target machine user’s shoes , would you???.

Anton Bassov

Well, I just think about the years of pain and agony caused by the PCI
resource arbiter and not having any way of supporting the dozens of
multi-function cards out there that, while they didn’t support the PCI
multi-function spec correctly, were never the less prolific and had to be
supported. mf.sys eventually solved the problem in a pretty nice fashion.
But, it would have been real nice if we could have just requested portions
of resources using some PnP methodology within our own bus drivers. No
mf.sys would have been necessary. Never could understand that one, although
I am certain there was a good reason. Anyway, just curious.

Bill M.

wrote in message news:xxxxx@ntdev…
>> Was there a reason for not using the model for PCI and such?
>
> I have my own theory about it…
>
> I think the point of the whole exercise is to make sure that no one
> provides his own version of PCI.SYS. Imagine the scenario when some device
> vendor wants to apply some “optimizations” to PCI bus driver in order to
> make everything work in a way that is most suitable for the device in
> question (for example, they may want to make sure some certain
> pre-defined resources are assigned to it). Although this way way be most
> suitable one for the device in question, it may be not-so-suitable for all
> other devices on the bus, especially if this custom bus driver is
> not-so-well implemented. Now imagine that vendors of more than one device
> on the target machine want to do it. You would not really want to be in
> the target machine user’s shoes , would you???.
>
> Anton Bassov
>

Primarily it is due to the fact that resource arbitration is hard to do and the interfaces used to do it change from release to release. If these interfaces were public, it would be very difficult to innovate in this space b/c you would have to somehow cram bugfixes/new features into the existing interfaces which may not accommodate such changes.

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bill McKenzie
Sent: Monday, January 21, 2008 3:49 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] IRP_MN_QUERY_RESOURCES

Well, I just think about the years of pain and agony caused by the PCI
resource arbiter and not having any way of supporting the dozens of
multi-function cards out there that, while they didn’t support the PCI
multi-function spec correctly, were never the less prolific and had to be
supported. mf.sys eventually solved the problem in a pretty nice fashion.
But, it would have been real nice if we could have just requested portions
of resources using some PnP methodology within our own bus drivers. No
mf.sys would have been necessary. Never could understand that one, although
I am certain there was a good reason. Anyway, just curious.

Bill M.

wrote in message news:xxxxx@ntdev…
>> Was there a reason for not using the model for PCI and such?
>
> I have my own theory about it…
>
> I think the point of the whole exercise is to make sure that no one
> provides his own version of PCI.SYS. Imagine the scenario when some device
> vendor wants to apply some “optimizations” to PCI bus driver in order to
> make everything work in a way that is most suitable for the device in
> question (for example, they may want to make sure some certain
> pre-defined resources are assigned to it). Although this way way be most
> suitable one for the device in question, it may be not-so-suitable for all
> other devices on the bus, especially if this custom bus driver is
> not-so-well implemented. Now imagine that vendors of more than one device
> on the target machine want to do it. You would not really want to be in
> the target machine user’s shoes , would you???.
>
> Anton Bassov
>


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

Doron,

Thanks for replying. Just curious…why all the churn in interfaces…has
PCI changed that much over time? Is it a chipset interface problem?

Bill M.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Primarily it is due to the fact that resource arbitration is hard to do and
the interfaces used to do it change from release to release. If these
interfaces were public, it would be very difficult to innovate in this space
b/c you would have to somehow cram bugfixes/new features into the existing
interfaces which may not accommodate such changes.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bill McKenzie
Sent: Monday, January 21, 2008 3:49 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] IRP_MN_QUERY_RESOURCES

Well, I just think about the years of pain and agony caused by the PCI
resource arbiter and not having any way of supporting the dozens of
multi-function cards out there that, while they didn’t support the PCI
multi-function spec correctly, were never the less prolific and had to be
supported. mf.sys eventually solved the problem in a pretty nice fashion.
But, it would have been real nice if we could have just requested portions
of resources using some PnP methodology within our own bus drivers. No
mf.sys would have been necessary. Never could understand that one, although
I am certain there was a good reason. Anyway, just curious.

Bill M.

wrote in message news:xxxxx@ntdev…
>> Was there a reason for not using the model for PCI and such?
>
> I have my own theory about it…
>
> I think the point of the whole exercise is to make sure that no one
> provides his own version of PCI.SYS. Imagine the scenario when some device
> vendor wants to apply some “optimizations” to PCI bus driver in order to
> make everything work in a way that is most suitable for the device in
> question (for example, they may want to make sure some certain
> pre-defined resources are assigned to it). Although this way way be most
> suitable one for the device in question, it may be not-so-suitable for all
> other devices on the bus, especially if this custom bus driver is
> not-so-well implemented. Now imagine that vendors of more than one device
> on the target machine want to do it. You would not really want to be in
> the target machine user’s shoes , would you???.
>
> Anton Bassov
>


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 think that it is driven exclusively by PCI changes, rather by OS changes/features around new usage of existing features as well as realizing that “X” does not work the way want it to, so revise it to “X1” so that it meets today’s needs better

d

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Bill McKenzie
Sent: Monday, January 21, 2008 4:12 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Re:IRP_MN_QUERY_RESOURCES

Doron,

Thanks for replying. Just curious…why all the churn in interfaces…has
PCI changed that much over time? Is it a chipset interface problem?

Bill M.

“Doron Holan” wrote in message
news:xxxxx@ntdev…
Primarily it is due to the fact that resource arbitration is hard to do and
the interfaces used to do it change from release to release. If these
interfaces were public, it would be very difficult to innovate in this space
b/c you would have to somehow cram bugfixes/new features into the existing
interfaces which may not accommodate such changes.

d

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Bill McKenzie
Sent: Monday, January 21, 2008 3:49 PM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] IRP_MN_QUERY_RESOURCES

Well, I just think about the years of pain and agony caused by the PCI
resource arbiter and not having any way of supporting the dozens of
multi-function cards out there that, while they didn’t support the PCI
multi-function spec correctly, were never the less prolific and had to be
supported. mf.sys eventually solved the problem in a pretty nice fashion.
But, it would have been real nice if we could have just requested portions
of resources using some PnP methodology within our own bus drivers. No
mf.sys would have been necessary. Never could understand that one, although
I am certain there was a good reason. Anyway, just curious.

Bill M.

wrote in message news:xxxxx@ntdev…
>> Was there a reason for not using the model for PCI and such?
>
> I have my own theory about it…
>
> I think the point of the whole exercise is to make sure that no one
> provides his own version of PCI.SYS. Imagine the scenario when some device
> vendor wants to apply some “optimizations” to PCI bus driver in order to
> make everything work in a way that is most suitable for the device in
> question (for example, they may want to make sure some certain
> pre-defined resources are assigned to it). Although this way way be most
> suitable one for the device in question, it may be not-so-suitable for all
> other devices on the bus, especially if this custom bus driver is
> not-so-well implemented. Now imagine that vendors of more than one device
> on the target machine want to do it. You would not really want to be in
> the target machine user’s shoes , would you???.
>
> Anton Bassov
>


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

The most recent example of this is multi-level rebalance, which is new to Vista. PnP and resource arbitration existed in Win2k, but Vista was the first release to really be able to rejigger the resources of the system to make an arbitrary device fit. Before that we really relied on BIOS configs, and things like hot-plug didn’t work all that well. The arbitration interfaces changed to support this.

http://www.microsoft.com/whdc/system/bus/PCI/multilevel-rebal.mspx

Dave