How to gain access to the PCI config space of a parent PCI to PCIe bridge from an NDIS 5.1 driver of a PCI network card? RRS feed

  • Question

  • Hello,

    i am maintaining an NDIS 5.1 driver for a PCIe network card. The actual network card is still a PCI design and uses a PCI to PCIe bridge chip. I need to access some registers in the PCI configuration space of the PCI to PCIe bridge chip. How  can i do that from an NDIS 5.1 network driver?

    I already solved this in the Linux driver for my card. There the solution was easy because the driver data structures already provide a pointer to the parent device.



    Friday, September 21, 2012 8:13 AM


  • Windows is not friendly to this kind of tweaking.

    But there still may be hope for you. IIRC some of these bridge chips can load their configuration from an EEPROM. If your bridge can do this, just add an appropriately programmed EEPROM, and you are done. 

    /* yes I know that eeprom chips cost money. But a month of your time costs much much more,  and peace of mind (hack-free, support call-free solution) is priceless */

    -- pa

    Monday, September 24, 2012 9:54 PM

All replies

  • there is no defined way to do this in windows. what specifically do you need to do to the bridge's config space? typically a scenario like this means hw that is not quite compatible with windows.

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Friday, September 21, 2012 4:26 PM
  • Hello,

    there is a configuration parameter called "prefetch enable" that is only accessible from PCI configuration space of the PCI to PCIe bridge. When we turned on this flag on the Linux driver we saw a huge performance gain in bus master DMA transfers from main memory to the NIC. This translates to higher network throughput in transmit direction.

    I think there should be a way to do this like: CM_Get_Device_ID() to get my own device instance id. Use that device instance id to call CM_Get_Parent(). Then use ReadWriteConfigSpace() to access PCI config space of the PCI to PCIe bridge

    What i do not know is: What value do i fill in the "DEVINST dnDevInst" parameter of the CM_Get_Device_ID() call?


    Monday, September 24, 2012 7:18 PM
  • those are all UM APIs, you can't call them in a driver

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Monday, September 24, 2012 8:33 PM
  • Yes, EEPROM would have been an option if we had known about this sooner.  Unfortunately the cards are already shipping for some time. So, for the moment the Linux driver will squeeze out a little bit more performance out of the card than the Windows driver.

    Many thanks for your answers guys!

    BR Martin

    Wednesday, September 26, 2012 6:12 AM
  • If it's critical, it might be worth adding a small UM component alongside the main kernel one and pass the data between the two...
    Wednesday, September 26, 2012 11:36 AM