none
how to check whether PCI Device is PCI-e ? RRS feed

  • Question

  • Hi,

    I like to know how to check whether PCI Device is PCI-e and then getting the PCI Express version?

    thanks.


    • Edited by Yuri.B Sunday, November 17, 2013 2:00 PM
    Sunday, November 17, 2013 1:06 PM

Answers

  • YOU CANNOT READ FROM THE PCI CONFIG REIGISTERS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  This will break the OS sooner or later, and you will be legally liable (trust me I know of a small company that was sued out of existance for pulling this crap).

    You are going to have to do a PCI Bus filter driver to get the information.  This has to be a WDM driver since KMDF is not supported.  From the Bus filter you will know the bus, and you wil see the device resources that PCI.sys allocates, so you may be able to derive some data that way.

    Just don't try to read the PCI config registers, unless you want to be cursed by most professionals.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    • Marked as answer by Yuri.B Saturday, November 23, 2013 3:01 PM
    Sunday, November 17, 2013 5:30 PM
  • I am making a PCI Identification application that retrieves all PCI Devices list with informations including its versions: PCI, PCI-E1.0a, PCI-E1.1, PCI-E2.0 ..

    my code does the scan of PCI Devices properly, and it includes methods for Reading from PCI Config Registers.

    You're having an Unusual Requirement. Unfortunately, Windows does not provide an easy  way to "scan" PCI bus.

    To tell PCI from PCIe, you can get the parent of your PCI devices using the documented SetupDi API. If the name of the parent is like "PCI express root port", then obviously it is PCIe.  How to get the PCIe version... you can map the IDs of PCI devices to PCI version (or whatever else you want) using a list or database. Or.... just boot Linux off an USB stick and type lspci (you can use this to populate the database).

    -- pa



    • Edited by Pavel A Sunday, November 17, 2013 6:43 PM
    • Marked as answer by Yuri.B Saturday, November 23, 2013 3:02 PM
    Sunday, November 17, 2013 6:29 PM
  • Why do you think you need this?  The operating system provides you with the devices resources just use them as they are.  This is not a situation like some systems where a capability of PCI-E needs to be interogated to be used.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Sunday, November 17, 2013 2:37 PM

All replies

  • Why do you think you need this?  The operating system provides you with the devices resources just use them as they are.  This is not a situation like some systems where a capability of PCI-E needs to be interogated to be used.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Sunday, November 17, 2013 2:37 PM
  • Why do you think you need this?  The operating system provides you with the devices resources just use them as they are.  This is not a situation like some systems where a capability of PCI-E needs to be interogated to be used.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    I am making a PCI Identification application that retrieves all PCI Devices list with informations including its versions: PCI, PCI-E1.0a, PCI-E1.1, PCI-E2.0 ..

    my code does the scan of PCI Devices properly, and it includes methods for Reading from PCI Config Registers.

    so is there any way for doing this PCI Identification: what are the PCI Registers' configurations from where I can get the needed information?






    • Edited by Yuri.B Sunday, November 17, 2013 4:03 PM
    Sunday, November 17, 2013 3:55 PM
  • YOU CANNOT READ FROM THE PCI CONFIG REIGISTERS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!  This will break the OS sooner or later, and you will be legally liable (trust me I know of a small company that was sued out of existance for pulling this crap).

    You are going to have to do a PCI Bus filter driver to get the information.  This has to be a WDM driver since KMDF is not supported.  From the Bus filter you will know the bus, and you wil see the device resources that PCI.sys allocates, so you may be able to derive some data that way.

    Just don't try to read the PCI config registers, unless you want to be cursed by most professionals.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    • Marked as answer by Yuri.B Saturday, November 23, 2013 3:01 PM
    Sunday, November 17, 2013 5:30 PM
  • OK, I understand.

    thanks.

    Saturday, November 23, 2013 3:01 PM