none
How to develop a WDF driver to support mutiple PCI boards? RRS feed

  • Question

  • I have achieved a driver to control a PCI board.

    Now I am going to insert the same 3 PCI boards at the same time.

    I need to modify my WDF driver to identify the 3 ones and control them seperately.

    I know the Device number(or Slot number) is the identification to distinguish different slots.

    How can I get the Device number(not the Device ID in configure space) to distinguish which slot a PCI board insert in?

    Is there any API function in WDF?

    Thanks for your help!

    Monday, May 30, 2016 6:55 AM

Answers

  • The IoGetDeviceProperty call https://msdn.microsoft.com/en-us/library/windows/hardware/ff549203%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 with option DevicePropertyLocationInformation will give you the information. 

    Unfortunately, the slot number does not relate to anything physical, since HW manufacturers do not match PCI slot number to any ordering.  In fact, I worked at a firm that ordered three new indentical computers, and each mapped the PCI slot numbers to the actual slot numbers differently.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, May 30, 2016 12:51 PM
  • No, WDF does not provide anything to identify PCI slots (besides of usual device properties that you already know about).

    One could think that WMI provides this information - alas, it does not. At least on anything earlier than Win10/Server 2016.

    So you have to invent some "heuristic". On many desktop-class system boards, PCI or PCIe  slots are associated with certain PCI bus number. Check in Device Manager if the bus number is presented as "slot number" for your devices as shown on picture below, if so -just do the same.

    As to how to identify the devices in slots - this depends on the devices. Network adapters usually are identified by their MAC address. All PCIe devices can have "serial number" attribute. It's up to the device maker.

    Regards,

    -- pa

    Monday, May 30, 2016 12:54 PM

All replies

  • The IoGetDeviceProperty call https://msdn.microsoft.com/en-us/library/windows/hardware/ff549203%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396 with option DevicePropertyLocationInformation will give you the information. 

    Unfortunately, the slot number does not relate to anything physical, since HW manufacturers do not match PCI slot number to any ordering.  In fact, I worked at a firm that ordered three new indentical computers, and each mapped the PCI slot numbers to the actual slot numbers differently.


    Don Burn Windows Driver Consulting Website: http://www.windrvr.com

    Monday, May 30, 2016 12:51 PM
  • No, WDF does not provide anything to identify PCI slots (besides of usual device properties that you already know about).

    One could think that WMI provides this information - alas, it does not. At least on anything earlier than Win10/Server 2016.

    So you have to invent some "heuristic". On many desktop-class system boards, PCI or PCIe  slots are associated with certain PCI bus number. Check in Device Manager if the bus number is presented as "slot number" for your devices as shown on picture below, if so -just do the same.

    As to how to identify the devices in slots - this depends on the devices. Network adapters usually are identified by their MAC address. All PCIe devices can have "serial number" attribute. It's up to the device maker.

    Regards,

    -- pa

    Monday, May 30, 2016 12:54 PM