Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2018 13:43:36 -0300
From:      "Dr. Rolf Jansen" <rj@obsigna.com>
To:        John-Mark Gurney <jmg@funkthat.com>
Cc:        freebsd-drivers@freebsd.org
Subject:   Re: Writing a PCIe-Driver
Message-ID:  <EA5F3EA3-0045-45B0-A915-D2AB5E38F070@obsigna.com>
In-Reply-To: <20180928161205.GN75530@funkthat.com>
References:  <B54DF398-9EA7-440A-BF44-0231642A1CF6@obsigna.com> <20180928161205.GN75530@funkthat.com>

index | next in thread | previous in thread | raw e-mail

> Am 28.09.2018 um 13:12 schrieb John-Mark Gurney <jmg@funkthat.com>:
> 
> Dr. Rolf Jansen wrote this message on Sun, Sep 23, 2018 at 12:56 -0300:
>> A couple of years ago, with the valuable help of people on this list, I managed to write a PCI driver for the National Instruments DAQ card, NI PCI-6251. The driver was kept very simple, only map the BAR???s and some DMA memory into the user space. The DAC/ADC and DIO is then all controlled from user space by writing command codes to certain offsets from the mapped BAR???s, and reading data from the mapped DMA memory and/or from other given offsets.
>> 
>> See: How to map device addresses into user space
>> https://lists.freebsd.org/pipermail/freebsd-drivers/2013-January/thread.html
>> 
>> Now, I need to do exactly the same for a PCIe card, namely the NI PCIe-6351. However, I even cannot see where to start. For PCI cards, the respective chapter 11 in the FreeBSD Architecture Handbook was quite helpful, for getting started, in no time, I got the PCI card probed and attached.
>> 
>> https://www.freebsd.org/doc/en_US.ISO8859-1/books/arch-handbook/pci.html
>> 
>> The dumb approach, probing the device ID and attaching the PCI(e) driver to the PCIe device in a similar fashion didn???t work - I didn???t expect this either, however, where would I start? How do I attach my driver to a PCIe card on FreeBSD 11 or 12?
> 
> I'm a bit surprised that this didn't work, as PCIe is effectively
> backwards compatible w/ PCI except a few exceptions like MSI...
> 
> Many drivers like em (sys/dev/e1000/if_em.c) are used for both PCI and
> PCIe cards..  Maybe look at what they are doing differently than your
> driver...

In the meantime, the issue has been resolved. See my other post on this list:

https://lists.freebsd.org/pipermail/freebsd-drivers/2018-September/002129.html <https://lists.freebsd.org/pipermail/freebsd-drivers/2018-September/002129.html>;

The driver is working now, and I am able to address the basic functionality of the NI PCIe-6351 DAQ board from user space. I didn’t come to check whether interrupts and DMA do work like it did with the older PCI DAQ boards.

Best regards

Rolf 

help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?EA5F3EA3-0045-45B0-A915-D2AB5E38F070>