Accessing configuration space of PCI-express bridge

Discussion in 'Windows Vista Drivers' started by Koen, Apr 13, 2007.

  1. Koen

    Koen Guest

    Hi,

    I've been searching a safe but fast method to access the configuration
    space of a PCI-e bridge/switch. We're building a device with multiple
    FPGA's behind and PCI-e bridge. To configure these FPGA's after power
    on, we need to send a byte stream (several Mbytes) to some of the
    bridge's I/O pins by writing one byte at a time to one of its extended
    configuration space registers.
    I've been looking at three ways to do this:
    1. Writing directly to the PCI configuration space registers using
    WRITE_PORT_UCHAR(). This is the method suggested by the vendor of the
    bridge. This however is considered to be unsafe and, as far as I know,
    will not allow our driver to get thru the WHQL tests to get signed
    (the latter being an requirement as we are targetting 64-bit Vista).
    2. Sending, from a driver or from a user mode application,
    IRP_MN_WRITE_CONFIG DeviceIoControls to the pci driver. This method
    will probably be slow as we'll face the overhead from an I/O operation
    for each byte that needs to be sent.
    3. Getting a BUS_INTERFACE_STANDARD driver interface standard from the
    bridge device allowing us to have direct access to the functions that
    write data to the configuration space. This would be our preferred
    method since I believe it is safe as well as fast.

    Both methods 2 and 3 require some kind of handle to the bridge's
    device object. Thus far I did not find any method to get such handle.
    The bridge (which is owned by the pci.sys driver) does however not
    have a SymbolicName that I can use as input to
    IoGetDeviceObjectPointer(). It also does not export any device
    interface that I could query using the SetupDi functions in order to
    obtain a device information path that I can use as input to
    CreateFile().

    As I am stuck here, I'm open to any idea ...

    Koen
     
    Koen, Apr 13, 2007
    #1
    1. Advertisements

  2. Having a driver that doesn't pass the WHQL tests is a *bad* idea, *but* you
    don't need to WHQL certify a driver to have it run on Vista. The requirement
    is that the driver is signed (e.g. using a certificate obtained by one of
    the certification authorities blessed by MS).

    Ciao
    GV
     
    Gianluca Varenni, Apr 13, 2007
    #2
    1. Advertisements

  3. Koen

    Don Burn Guest

    I don't have a problem with it not being WHQL certified, but doing your own
    writes to the PCI configuration space is a great way to cause spurious
    crashes that are very hard to find. I know of a case where a firm did this
    crap, and it took forever to find the problem. Fortunately when it was
    found, they were trying to sell their part to a company that had been stuck
    trying to chase down some of the crashes they caused, the company not only
    did not buy the part, they let a lot of other people know the firm was
    selling crap.

    Doing this is a great way for a developer and his firm to be cursed forever
    by the Windows driver community.


    --
    Don Burn (MVP, Windows DDK)
    Windows 2k/XP/2k3 Filesystem and Driver Consulting
    Website: http://www.windrvr.com
    Blog: http://msmvps.com/blogs/WinDrvr
    Remove StopSpam to reply
     
    Don Burn, Apr 13, 2007
    #3
  4. I agree 150% with you. My "doesn't pass the WHQL tests is a *bad* idea" was
    a subtle way to say "if your driver doesnt pass the tests there are very
    good chances that your driver smells really badly. Uh... playing with the
    PCI configuration space is definitely one of those stinky things"

    Have a nice day
    GV
     
    Gianluca Varenni, Apr 13, 2007
    #4
  5. Koen

    Koen Guest

    Thanks for your comments. I didn't know you don't need to pass the
    WHQL tests to get your driver properly signed.
    Knowing this doesn't help me really however as I do understand that
    writing to the PCI config space directly from within a signed driver
    is as dangerous as doing it from within an unsigned driver.
    Any idea how to do it properly ?

    Koen
     
    Koen, Apr 16, 2007
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.