Detect the pci bus/bridge device

Hi

The HW guys in my company has made an adapter containing a pci bridge and two pci devices. My driver cannot see the pci bridge. Only the pci devices. It is possible to put several of these adapters in a PCI. My problem is that I need to pair the pci devices i.e. the driver needs to know which pci devices that are placed on the same pci bridge.

Is there a way that I can use to detect that two pci devices are placed on the same pci bridge?

Regards
Bent

Hi Bent,

Are those bridge and pci devices attached not gettign enumerated durign
bootup process by platform software/ bios?

If not then , you may need to enumerate the pci bridge and then configre
the pci bridge and devices attached to it as they gets discoverd.
configuration mainly involves setting the primary, secondary and
sub-ordinate bus no.


Regards,
Mohan Tarole
HCL Technologies, Hyderabad

On Tue, Aug 11, 2015 at 4:42 PM, wrote:

> Hi
>
> The HW guys in my company has made an adapter containing a pci bridge and
> two pci devices. My driver cannot see the pci bridge. Only the pci devices.
> It is possible to put several of these adapters in a PCI. My problem is
> that I need to pair the pci devices i.e. the driver needs to know which pci
> devices that are placed on the same pci bridge.
>
> Is there a way that I can use to detect that two pci devices are placed on
> the same pci bridge?
>
> Regards
> Bent
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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 bridge is handled by windows itself and the pci devices is handled by my driver. I need to get information about the bridge, so I can pair my pci devices, but as I am quite new to drivers. I do not know how to get information about the bridge or about the device stack. What I think I need is to get information about the device stack, so I can see which of my pci devices that are placed on the same bridge.

In another way. How to I parse a device stack?

Regards
Bent

The Bus number property in device manager is correct, right?

See IoGetDeviceProperty DevicePropertyBusNumber

Mark Roddy

On Tue, Aug 11, 2015 at 7:12 AM, wrote:

> Hi
>
> The HW guys in my company has made an adapter containing a pci bridge and
> two pci devices. My driver cannot see the pci bridge. Only the pci devices.
> It is possible to put several of these adapters in a PCI. My problem is
> that I need to pair the pci devices i.e. the driver needs to know which pci
> devices that are placed on the same pci bridge.
>
> Is there a way that I can use to detect that two pci devices are placed on
> the same pci bridge?
>
> Regards
> Bent
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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 first thought that comes to mind is any device after the same bridge will have the same bus number. Devices behind other bridges *should*(??) have different bus numbers.

Greg

xxxxx@napatech.com wrote:

From: xxxxx@napatech.com
To: “Windows System Software Devs Interest List”
Subject: RE:[ntdev] Detect the pci bus/bridge device
Date: Tue, 11 Aug 2015 08:50:36 -0400 (EDT)

The bridge is handled by windows itself and the pci devices is handled by my driver. I need to get information about the bridge, so I can pair my pci devices, but as I am quite new to drivers. I do not know how to get information about the bridge or about the device stack. What I think I need is to get information about the device stack, so I can see which of my pci devices that are placed on the same bridge.

In another way. How to I parse a device stack?

Regards
Bent


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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 Bus number property in device manager is correct, but they are different. Each pci device is placed on a different bus on the bridge and this is the bus number shown. It is not the bus number for the pci bridge. So the IoGetDeviceProperty does not help me.

Regards
Bent

You can parse the device stack from user mode - see the devcon sample from
the WDK.

Mark Roddy

On Tue, Aug 11, 2015 at 10:08 AM, wrote:

> The Bus number property in device manager is correct, but they are
> different. Each pci device is placed on a different bus on the bridge and
> this is the bus number shown. It is not the bus number for the pci bridge.
> So the IoGetDeviceProperty does not help me.
>
> Regards
> Bent
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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 suggest to add the serial number descriptor to the config, and make the serial numbers of paired devices easily recognizable (for example, next to each other)

Hmmmm… As Mr. Roddy answered initially, I think IoGetDeviceProperty (or the KMDF alternative) is what you’re looking for.

Peter
OSR
@OSRDrivers

I think he wants to be able to know that device A on bus 2 and device B on
bus 3 are both on bridge 1. If he really needs to do that he may have to
build the actual bus topology from user mode.

Mark Roddy

On Tue, Aug 11, 2015 at 1:59 PM, wrote:

> Hmmmm… As Mr. Roddy answered initially, I think IoGetDeviceProperty (or
> the KMDF alternative) is what you’re looking for.
>
> Peter
> OSR
> @OSRDrivers
>
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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
>

Can you remake the bridge so that all devices hanging down it are on the same bus number?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> The Bus number property in device manager is correct, but they are different. Each pci device is placed on a different bus on the bridge and this is the bus number shown. It is not the bus number for the pci bridge. So the IoGetDeviceProperty does not help me.
>
> Regards
> Bent
>

PCI Express is Point-to-Point. So each device on the downstream side of a
PCIe bridge has its own unique bus number. A PCIe bridge with two
secondary busses really looks like three PCI bridges; one virtual bridge
going to an internal virtual bus and then two bridges to the two
downstream busses.

“Maxim S. Shatskih”
Sent by: xxxxx@lists.osr.com
08/12/2015 04:33 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
Re:[ntdev] Detect the pci bus/bridge device

Can you remake the bridge so that all devices hanging down it are on
the same bus number?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> The Bus number property in device manager is correct, but they are
different. Each pci device is placed on a different bus on the bridge and
this is the bus number shown. It is not the bus number for the pci bridge.
So the IoGetDeviceProperty does not help me.
>
> Regards
> Bent
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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

Bus number can be same only for multi-function pci(e) device. in this case
while enumeration multiple devices (max 8) will get discoverd with same bus
but with different device/ function no.
Unless i am missing somting - I do not think there can be a bridge with
more than one secondary buse. There is no space to store more than one
secondary bus nos in config space.


Mohan Tarole
HCL Technologies, Hyderabad

On Wed, Aug 12, 2015 at 10:23 PM, wrote:

>
> PCI Express is Point-to-Point. So each device on the downstream side of a
> PCIe bridge has its own unique bus number. A PCIe bridge with two
> secondary busses really looks like three PCI bridges; one virtual bridge
> going to an internal virtual bus and then two bridges to the two downstream
> busses.
>
>
>
> “Maxim S. Shatskih” >
> Sent by: xxxxx@lists.osr.com
>
> 08/12/2015 04:33 AM
> Please respond to
> “Windows System Software Devs Interest List”
>
> To
> “Windows System Software Devs Interest List”
> cc
> Subject
> Re:[ntdev] Detect the pci bus/bridge device
>
>
>
>
> Can you remake the bridge so that all devices hanging down it are on
> the same bus number?
>
> –
> Maxim S. Shatskih
> Microsoft MVP on File System And Storage
> xxxxx@storagecraft.com
> http://www.storagecraft.com
>
> wrote in message news:xxxxx@ntdev…
> > The Bus number property in device manager is correct, but they are
> different. Each pci device is placed on a different bus on the bridge and
> this is the bus number shown. It is not the bus number for the pci bridge.
> So the IoGetDeviceProperty does not help me.
> >
> > Regards
> > Bent
> >
>
> —
> NTDEV is sponsored by OSR
>
> Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
> OSR is HIRING!! See http://www.osr.com/careers
>
> 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 Visit the list at:
> http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
> http://www.osr.com/careers 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

First, I was not referring to the case of a single multi-function device
on the secondary side of the “PCIe bridge.” And the correct term here is
PCIe switch, which is a device used to connect two (or more) separate PCIe
Devices (each of which may contain multiple Functions) on one card to the
PCIe bus. So to correct my terminology below, a PCIe SWITCH with two
secondary busses really looks like three (or more) PCI bridges; one bridge
going to an internal virtual bus and then two (or more) bridges going to
the two (or more) downstream busses.

Mohan Tarole
Sent by: xxxxx@lists.osr.com
08/13/2015 02:22 AM
Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
Re: [ntdev] Detect the pci bus/bridge device

Bus number can be same only for multi-function pci(e) device. in this case
while enumeration multiple devices (max 8) will get discoverd with same
bus but with different device/ function no.
Unless i am missing somting - I do not think there can be a bridge with
more than one secondary buse. There is no space to store more than one
secondary bus nos in config space.

---------------------------------------------
Mohan Tarole
HCL Technologies, Hyderabad

On Wed, Aug 12, 2015 at 10:23 PM, wrote:

PCI Express is Point-to-Point. So each device on the downstream side of a
PCIe bridge has its own unique bus number. A PCIe bridge with two
secondary busses really looks like three PCI bridges; one virtual bridge
going to an internal virtual bus and then two bridges to the two
downstream busses.

“Maxim S. Shatskih”
Sent by: xxxxx@lists.osr.com
08/12/2015 04:33 AM

Please respond to
“Windows System Software Devs Interest List”

To
“Windows System Software Devs Interest List”
cc

Subject
Re:[ntdev] Detect the pci bus/bridge device

Can you remake the bridge so that all devices hanging down it are on
the same bus number?


Maxim S. Shatskih
Microsoft MVP on File System And Storage
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntdev…
> The Bus number property in device manager is correct, but they are
different. Each pci device is placed on a different bus on the bridge and
this is the bus number shown. It is not the bus number for the pci bridge.
So the IoGetDeviceProperty does not help me.
>
> Regards
> Bent
>


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

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 Visit the list at:
http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
http://www.osr.com/careers 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 Visit the list at:
http://www.osronline.com/showlists.cfm?list=ntdev OSR is HIRING!! See
http://www.osr.com/careers 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 devcon sample code has solved my problem. I am able to parse the device stack and get the information I need, by using the commands used by devcon.

Thanks to you all for the help.

Regards
Bent