none
PDO creation for a Port on a contoller RRS feed

  • Question

  • Our requirement is we have multi serial port card based on PCIe and design is focusing on 

    a) Controller Driver (Functional driver for Controller & Bus driver for Ports on controller controller driver - Cdriver.sys)

    b) Port Driver (Pdriver.sys)

    we are developing a bus driver for controller on which 10 ports are populated

    PCI driver provides the resource list for the controller for the upper layer driver(Cdriver.sys) i.e., Our driver which act as Functional driver for controller and bus driver for ports, I am confused where and how to send the resource list for ports to the upper driver which is a Functional driver(Pdriver.sys) for the ports on the controller.



    vidyasagar196


    Friday, May 23, 2014 7:58 AM

Answers

All replies

  • You don't need to, the PnP manger will do it for you. The PnP manager will query the resources of each PDO as it is enumerated, and when the child DevStack is started it will deliver the resources via the START_DEVICE IRP

     -Brian


    Azius Developer Training www.azius.com Windows device driver, internals, security, & forensics training and consulting. Blog at www.azius.com/blog

    Friday, May 23, 2014 8:33 AM
    Moderator
  • But In this case the Port Base Address should be retrieved from the PCI-e configuration space which at BAR1.

    where each PORT configuration space is 512 Bytes.Base address of each Port configuration space should be retrieved from PDO resourcelist since Base address of each Port configuration space is having different offset.

    here i need to know how to send different address to each PDO?


    vidyasagar196

    Friday, May 23, 2014 8:48 AM
  • First I a pretty sure you will need a bus driver.  Even if the ports are seperate for each device, I suspect you are sharing a single interrupt resource for all the devices.   The simplest approach is to have the bus driver support a device interface that will accept an Interrupt Service Routine address and context pointer from the function driver, and return a list of ports, plus pointers to interrupt spin lock support routines.

    I've done this for a lot of clients in the last couple of years, these were all based on Altera FPGA which seem to be popular, but most people configure wrong for use with mf.sys.


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

    Friday, May 23, 2014 11:08 AM
  • you can't assign and subdivide resources assigned to the controller to each port PDO.  the interfaces to do this are private to the OS. What don suggests below is your path forward. The PDO supports a private interface that the pdriver.sys queries for and that interface can provide the resource information, read http://blogs.msdn.com/b/doronh/archive/2007/03/06/interfaces-can-contain-both-input-and-output-parameters-and-not-just-function-pointers.aspx

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

    Friday, May 23, 2014 6:08 PM
  • PCI config space is memory mapped in Cdriver.sys and retrieves the base address of UART config space by reading BAR1 register of PCI config space.Now we need to send the UART config space to the Pdriver.sys so that it can map UART Config space in preparehardware  callback so that FDO can for the each port can be created.


    vidyasagar196

    Monday, May 26, 2014 7:21 AM
  • Hi Don,

     

    If we adapt the approach of exchanging ISR address, and hardware resource using  the INTERFACE structures, then below is our understanding of how interrupts are delivered to the function driver. Please confirm my understanding.

     

    When a function generates an interrupt, the ISR in the bus driver will be called. In this ISR, we need to probe and find out which function has generated the interrupt and call the corresponding ISR for that function along with the interrupt context.

     

     

    In the function driver, while exchanging the interrupt routines and hardware resources with the bus driver, in which call back in function driver do we need to query the interface of the PDO? Is it under EvtDriverDeviceAdd() function?


    vidyasagar196

    Monday, May 26, 2014 7:46 AM
  • If your hardware has an easy way (such as an interrupt register that shows which device is interrupting) then have the bus driver do the decision, otherwise call each registered interrupt in turn.  Remember interrupt service routines need to handle the case of being called when their device is not interrupting.


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

    Monday, May 26, 2014 10:43 AM