Device driver for FPGA with 2 PCIe cores

Hello,

My FPGA contains 2 PCIe cores each has different vendor id\device id.

Is there a simple way (by the book) to create one sys+inf file for both
cores ?

Best regards,
Z.V

On 18-Oct-2015 20:35, Zvi Vered wrote:

Hello,

My FPGA contains 2 PCIe cores each has different vendor id\device id.

Is there a simple way (by the book) to create one sys+inf file for both
cores ?

Sure, if both devices belong to same setup class.
If you can’t find a certain class for these devices, make it “Other”
( {4D36E97E-E325-11CE-BFC1-08002BE10318} )

Pretty simple.
– pa

Sure so long as both functions are in the same Device Class.

The Id read from the device is the “Device Id”. Yes, it may have a portion of it that uniquely is assigned to the vendor of the device but as far as the INF is concerned it is all just a DeviceId. There is not concept of vendor in the INF. There is the seemingly similar concept of “Manufacture” but that again is just an organizational mechanism in the INF.

Good Luck,
Dave Cattley

Hi Pavel,David,All,

The sample driver src\general\PLX9x5x\sys contains a file: Pci9656.c
This file contains the routine DriverEntry.

Should the sys file that supports both devices have 2 DriverEntry ?

Beside the inx file, there is no reference in the C code to VendorId or DeviceId

So how can I build a sys file that handles 2 PCIe cores ?

Both devices belong to the same setup class.

Thank you,
Z.V

It is a runtime detection, the image is loaded once and when the device stack is being built it figures out which type of device

Sent from Outlook Mailhttp: for Windows 10 phone

From: xxxxx@gmail.com
Sent: Sunday, October 25, 2015 2:14 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Device driver for FPGA with 2 PCIe cores

Hi Pavel,David,All,

The sample driver src\general\PLX9x5x\sys contains a file: Pci9656.c
This file contains the routine DriverEntry.

Should the sys file that supports both devices have 2 DriverEntry ?

Beside the inx file, there is no reference in the C code to VendorId or DeviceId

So how can I build a sys file that handles 2 PCIe cores ?

Both devices belong to the same setup class.

Thank you,
Z.V


NTDEV is sponsored by OSR

Visit the list at: https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.com%2Fshowlists.cfm%3Flist%3Dntdev&data=01|01|Doron.Holan%40microsoft.com|a1575b727c9646fa689f08d2dd814412|72f988bf86f141af91ab2d7cd011db47|1&sdata=3B%2BduCt3CP3IBT3PJ1bStEmcniEv85JynVTR%2BqY%2FQig%3D

OSR is HIRING!! See https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osr.com%2Fcareers&data=01|01|Doron.Holan%40microsoft.com|a1575b727c9646fa689f08d2dd814412|72f988bf86f141af91ab2d7cd011db47|1&sdata=4a7UkY2lB6S%2FHCwZp7XuHBnHwzKHkF7mjs%2B4DTtvO%2BI%3D

For our schedule of WDF, WDM, debugging and other seminars visit:
https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osr.com%2Fseminars&data=01|01|Doron.Holan%40microsoft.com|a1575b727c9646fa689f08d2dd814412|72f988bf86f141af91ab2d7cd011db47|1&sdata=m09AVuSyv%2BVpiezZTTTkSh8ocAiCYxhehOX1JB4a%2B5E%3D

To unsubscribe, visit the List Server section of OSR Online at https://na01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.osronline.com%2Fpage.cfm%3Fname%3DListServer&amp;data=01|01|Doron.Holan%40microsoft.com|a1575b727c9646fa689f08d2dd814412|72f988bf86f141af91ab2d7cd011db47|1&amp;sdata=qF0sbIBnH5LOtk%2FOwIVunAJVOMS9Jokg2dtzr886l8o%3D</http:>

Three options to make a driver support multiple device:

  1. In the INF file, have unique devices associated with the VEN/DEV pattern You can specify some registry option to set for each device type, which you can then query in your device add routine. This also generally requires some sort of device type designator in the device content, so when you get a call from the OS, you can know which kind of device it is. Bus drivers are basically driver that handle both an fdo device and a pdo device, so looking at the Toaster bus sample gives one way to do this.

  2. In your device add, you get an interface to the config space, and read values to help you know which kind of device you are adding. You then set values in your device context to do the right thing with the specific hardware.

  3. Make unique binaries for each device type, and get the INF to install the correct binary for the device type being installed. Just because you have unique binaries doesn’t mean you can’t share most of the source code.

Also note that if you’re writing C++, I can be handy to make a base type that does all the stuff common between all your different device types, and then you have sub classes for each specific type. You can then do the routing to code for the correct device type using virtual functions, where the virtual function table is the thing that selects between the different kinds of devices. In the past I made the device context be an instance of a class, casting a pointer to/from the base class type to/from PVOID when crossing the boundary between the OS and the driver.

Jan

On 10/25/15, 2:13 PM, “xxxxx@lists.osr.com on behalf of xxxxx@gmail.com” wrote:

>Hi Pavel,David,All,
>
>The sample driver src\general\PLX9x5x\sys contains a file: Pci9656.c
>This file contains the routine DriverEntry.
>
>Should the sys file that supports both devices have 2 DriverEntry ?
>
>Beside the inx file, there is no reference in the C code to VendorId or DeviceId
>
>So how can I build a sys file that handles 2 PCIe cores ?
>
>Both devices belong to the same setup class.
>
>Thank you,
>Z.V
>
>
>
>—
>NTDEV is sponsored by OSR
>
>Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev
>
>OSR is HIRING!! See http://www.osr.com/careers
>
>For our schedule of WDF, WDM, debugging and other seminars visit:
>http://www.osr.com/seminars
>
>To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer

No you cannot have 2 DriverEntry’s either you create 2 separate drivers, or
you at AddDevice time figure out which device this is and then use that
condition throughout the rest of the driver to determine how to talk to
things. Unless the devices are quite similar make 2 drivers.

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

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@gmail.com
Sent: Sunday, October 25, 2015 5:14 PM
To: Windows System Software Devs Interest List
Subject: RE:[ntdev] Device driver for FPGA with 2 PCIe cores

Hi Pavel,David,All,

The sample driver src\general\PLX9x5x\sys contains a file: Pci9656.c This
file contains the routine DriverEntry.

Should the sys file that supports both devices have 2 DriverEntry ?

Beside the inx file, there is no reference in the C code to VendorId or
DeviceId

So how can I build a sys file that handles 2 PCIe cores ?

Both devices belong to the same setup class.

Thank you,
Z.V


NTDEV is sponsored by OSR

Visit the list at: http://www.osronline.com/showlists.cfm?list=ntdev

OSR is HIRING!! See http://www.osr.com/careers

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

On 25-Oct-2015 23:13, xxxxx@gmail.com wrote:

Should the sys file that supports both devices have 2 DriverEntry ?

Only one DriverEntry and one AddDevice.
The AddDevice() will distinguish the kind of device by some property,
for example, the device id in PCI config space.

Regards,
– pa

Dear Members,

Thank you for your help !

Best regards,
Z.V