Hi.

Is there any way to get the device object of the bus driver whoâ??s created
the PDO to which our device is attached?

To be precise, I have a legacy PCI device which works more reliably with old
applications if itâ??s been assigned legacy I/O addresses (i.e. 12-bit ISA
ports below 0x1000). To achieve this, I use the PCI bridge
subtractive-decode: add extra resource lists with desired resources to the
resource requirements list and then rely on PnP Manager to assign one if
available, or just use boot resources in case of a positive-only bridge or if
resources arenâ??t available.

However, on one particular system, Iâ??ve hit a problem where although the
bridge does not support subtractive-decode (based on â??How Windows Identifies
and Supports Bridge Typesâ?? section of â??Supporting Subtractive PCI-to-PCI
Bridges in Windowsâ??), PnP manager still sends me resources which are only
available for a subtractive-decode bridge. This apparently ends up in a crash
and possibly is a bug in PnP/PCI driver(?).

As a workaround, Iâ??m trying to get the device object of the underlying PCI
bridge (which is on a different stack) and use it to read the PCI config
space of the bridge and verify if the programming interface (in class code)
is 01.

How could this be done? Are there any other ways of achieving this?

Thanks,
DaveH

Re: How to get enumerator's DO (due to possible system bug)? by Maxim

Maxim
Mon Jul 14 13:10:53 CDT 2008

> Is there any way to get the device object of the bus driver whoâ??s created
> the PDO to which our device is attached?

Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send down the
stack.

Or... the PDO pointer is the parameter to AddDevice.

--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@storagecraft.com
http://www.storagecraft.com


Re: How to get enumerator's DO (due to possible system bug)? by Calvin

Calvin
Tue Jul 15 01:27:10 CDT 2008

I think the OP wants the PDO of the bus FDO. QDR/target doesn't work.
otherwise it's too easy to solve, no need qdr/target at all.

--
Calvin Guan
Broadcom Corporation
Connecting Everything(r)

"Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
news:OkuZ1zd5IHA.4448@TK2MSFTNGP05.phx.gbl...
>> Is there any way to get the device object of the bus driver who's created
>> the PDO to which our device is attached?
>
> Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send
> down the
> stack.
>
> Or... the PDO pointer is the parameter to AddDevice.
>
> --
> Maxim Shatskih, Windows DDK MVP
> StorageCraft Corporation
> maxim@storagecraft.com
> http://www.storagecraft.com
>



Re: How to get enumerator's DO (due to possible system bug)? by DaveH

DaveH
Tue Jul 15 09:53:04 CDT 2008

Cavlin is right, QDR/target won't work as it returns the PDO which my FDO is
attached to and I already have this.

What I found I could do (d might yell at me!) is to strip DEVICE_OBJECT to
get DEVICE_NODE from DEVOBJ_EXTENSION. DEVICE_NODE has a Parent pointer from
which I can get PhysicalDeviceObject of the Parent in device tree. But by
doing so, I'm lurking in undocumented OS code which isn't safe (e.g. it's
different in 2k compared to XP/Vista).

Any thoughts on the above, or any safe recommendations? Also the fact that
PnP assigns I/O ranges outside the bridge window, although the bridge doesn't
support subtractive decode, looks like a bug to me. Any idea on this?

"Calvin Guan" wrote:

> I think the OP wants the PDO of the bus FDO. QDR/target doesn't work.
> otherwise it's too easy to solve, no need qdr/target at all.
>
> --
> Calvin Guan
> Broadcom Corporation
> Connecting Everything(r)
>
> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> news:OkuZ1zd5IHA.4448@TK2MSFTNGP05.phx.gbl...
> >> Is there any way to get the device object of the bus driver who's created
> >> the PDO to which our device is attached?
> >
> > Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send
> > down the
> > stack.
> >
> > Or... the PDO pointer is the parameter to AddDevice.
> >
> > --
> > Maxim Shatskih, Windows DDK MVP
> > StorageCraft Corporation
> > maxim@storagecraft.com
> > http://www.storagecraft.com
> >
>
>
>

Re: How to get enumerator's DO (due to possible system bug)? by DaveH

DaveH
Tue Jul 15 10:30:02 CDT 2008

Just a bit more clarification: In following tree, I need bridge PDO to be
able to query its PCI config space for it's class code/progif (01 is
subtractive-decode bridge; 00 isn't).

kd> !devnode 0 1 pci
Dumping IopRootDeviceNode (= 0x82db5008)
DevNode 0x82d961a8 for PDO 0x82de9520
InstancePath is "ACPI\PNP0A03\1"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x82d972d0 for PDO 0x82ded7a0 <===============
pdo of the bridge
InstancePath is
"PCI\VEN_10B9&DEV_5249&SUBSYS_00000000&REV_00\3&13c0b0c5&0&10"
ServiceName is "pci"
State = DeviceNodeStarted (0x308)
Previous State = DeviceNodeEnumerateCompletion (0x30d)
DevNode 0x82dac008 for PDO 0x82dadb18 <===============
pdo of my driver
InstancePath is
"PCI\VEN_xxxx&DEV_yyyy&SUBSYS_yyyyxxxx&REV_00\4&1011ee3f&0&3110"
ServiceName is "zzzz"
State = DeviceNodeDriversAdded (0x303)
Previous State = DeviceNodeInitialized (0x302)


"DaveH" wrote:

> Cavlin is right, QDR/target won't work as it returns the PDO which my FDO is
> attached to and I already have this.
>
> What I found I could do (d might yell at me!) is to strip DEVICE_OBJECT to
> get DEVICE_NODE from DEVOBJ_EXTENSION. DEVICE_NODE has a Parent pointer from
> which I can get PhysicalDeviceObject of the Parent in device tree. But by
> doing so, I'm lurking in undocumented OS code which isn't safe (e.g. it's
> different in 2k compared to XP/Vista).
>
> Any thoughts on the above, or any safe recommendations? Also the fact that
> PnP assigns I/O ranges outside the bridge window, although the bridge doesn't
> support subtractive decode, looks like a bug to me. Any idea on this?
>
> "Calvin Guan" wrote:
>
> > I think the OP wants the PDO of the bus FDO. QDR/target doesn't work.
> > otherwise it's too easy to solve, no need qdr/target at all.
> >
> > --
> > Calvin Guan
> > Broadcom Corporation
> > Connecting Everything(r)
> >
> > "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> > news:OkuZ1zd5IHA.4448@TK2MSFTNGP05.phx.gbl...
> > >> Is there any way to get the device object of the bus driver who's created
> > >> the PDO to which our device is attached?
> > >
> > > Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send
> > > down the
> > > stack.
> > >
> > > Or... the PDO pointer is the parameter to AddDevice.
> > >
> > > --
> > > Maxim Shatskih, Windows DDK MVP
> > > StorageCraft Corporation
> > > maxim@storagecraft.com
> > > http://www.storagecraft.com
> > >
> >
> >
> >

Re: How to get enumerator's DO (due to possible system bug)? by Doron

Doron
Tue Jul 15 12:35:38 CDT 2008

seriously, do not do this. the field does and can move from release to
release/SP to SP and can even go away. why not install a filter on the
parent device object's stack based on the hw ID for the broken bridge?

d

--
Please do not send e-mail directly to this alias. this alias is for
newsgroup purposes only.
This posting is provided "AS IS" with no warranties, and confers no rights.


"DaveH" <DaveH@discussions.microsoft.com> wrote in message
news:BBF218D6-461C-435A-821B-07F31878E35C@microsoft.com...
> Cavlin is right, QDR/target won't work as it returns the PDO which my FDO
> is
> attached to and I already have this.
>
> What I found I could do (d might yell at me!) is to strip DEVICE_OBJECT to
> get DEVICE_NODE from DEVOBJ_EXTENSION. DEVICE_NODE has a Parent pointer
> from
> which I can get PhysicalDeviceObject of the Parent in device tree. But by
> doing so, I'm lurking in undocumented OS code which isn't safe (e.g. it's
> different in 2k compared to XP/Vista).
>
> Any thoughts on the above, or any safe recommendations? Also the fact that
> PnP assigns I/O ranges outside the bridge window, although the bridge
> doesn't
> support subtractive decode, looks like a bug to me. Any idea on this?
>
> "Calvin Guan" wrote:
>
>> I think the OP wants the PDO of the bus FDO. QDR/target doesn't work.
>> otherwise it's too easy to solve, no need qdr/target at all.
>>
>> --
>> Calvin Guan
>> Broadcom Corporation
>> Connecting Everything(r)
>>
>> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
>> news:OkuZ1zd5IHA.4448@TK2MSFTNGP05.phx.gbl...
>> >> Is there any way to get the device object of the bus driver who's
>> >> created
>> >> the PDO to which our device is attached?
>> >
>> > Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send
>> > down the
>> > stack.
>> >
>> > Or... the PDO pointer is the parameter to AddDevice.
>> >
>> > --
>> > Maxim Shatskih, Windows DDK MVP
>> > StorageCraft Corporation
>> > maxim@storagecraft.com
>> > http://www.storagecraft.com
>> >
>>
>>
>>


Re: How to get enumerator's DO (due to possible system bug)? by DaveH

DaveH
Wed Jul 16 06:27:56 CDT 2008

Well, I found a way which doesn't involve the nasty workaround; however I
felt beaten and betrayed as I could do it from user-mode and not within
kernel!

I'm now using device co-installer. During installation, I can get a DEVINST
of my device which is similar to device node. I then use CM_Get_Parent to get
the parent devnode (pci bridge) and CM_Get_DevNode_Registry_Property on the
parent to get it's compatible IDs. PCI driver should have created compatible
IDs like PCI\...&CC_xxyyzz which gives me exactly what I want, i.e. class
code of the bridge.


"Doron Holan [MSFT]" wrote:

> seriously, do not do this. the field does and can move from release to
> release/SP to SP and can even go away. why not install a filter on the
> parent device object's stack based on the hw ID for the broken bridge?
>
> d
>
> --
> Please do not send e-mail directly to this alias. this alias is for
> newsgroup purposes only.
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
>
> "DaveH" <DaveH@discussions.microsoft.com> wrote in message
> news:BBF218D6-461C-435A-821B-07F31878E35C@microsoft.com...
> > Cavlin is right, QDR/target won't work as it returns the PDO which my FDO
> > is
> > attached to and I already have this.
> >
> > What I found I could do (d might yell at me!) is to strip DEVICE_OBJECT to
> > get DEVICE_NODE from DEVOBJ_EXTENSION. DEVICE_NODE has a Parent pointer
> > from
> > which I can get PhysicalDeviceObject of the Parent in device tree. But by
> > doing so, I'm lurking in undocumented OS code which isn't safe (e.g. it's
> > different in 2k compared to XP/Vista).
> >
> > Any thoughts on the above, or any safe recommendations? Also the fact that
> > PnP assigns I/O ranges outside the bridge window, although the bridge
> > doesn't
> > support subtractive decode, looks like a bug to me. Any idea on this?
> >
> > "Calvin Guan" wrote:
> >
> >> I think the OP wants the PDO of the bus FDO. QDR/target doesn't work.
> >> otherwise it's too easy to solve, no need qdr/target at all.
> >>
> >> --
> >> Calvin Guan
> >> Broadcom Corporation
> >> Connecting Everything(r)
> >>
> >> "Maxim S. Shatskih" <maxim@storagecraft.com> wrote in message
> >> news:OkuZ1zd5IHA.4448@TK2MSFTNGP05.phx.gbl...
> >> >> Is there any way to get the device object of the bus driver who's
> >> >> created
> >> >> the PDO to which our device is attached?
> >> >
> >> > Handicraft IRP_MN_QUERY_DEVICE_RELATIONS/TargetDeviceRelation and send
> >> > down the
> >> > stack.
> >> >
> >> > Or... the PDO pointer is the parameter to AddDevice.
> >> >
> >> > --
> >> > Maxim Shatskih, Windows DDK MVP
> >> > StorageCraft Corporation
> >> > maxim@storagecraft.com
> >> > http://www.storagecraft.com
> >> >
> >>
> >>
> >>
>
>