Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 23 Sep 2018 23:45:18 -0300
From:      "Dr. Rolf Jansen" <rj@obsigna.com>
To:        freebsd-drivers@freebsd.org
Subject:   Writing a PCIe-Driver
Message-ID:  <F756788B-591D-4B9D-B58B-B0C07FE4E233@obsigna.com>

next in thread | raw e-mail | index | archive | help
Hello,

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=E2=80=99s =
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=E2=80=99s, 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.ht=
ml


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=E2=80=99t work - I didn=E2=80=
=99t expect this either, however, where would I start? How do I attach =
my driver to a PCIe card on FreeBSD 11 or 12?

Please can somebody push me into the right direction. Once I got the =
driver attached to the card, I guess, I would be able to adapt the =
mem-mapping code of my old driver for the new card.

Best regards

Rolf



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?F756788B-591D-4B9D-B58B-B0C07FE4E233>