Subject: Re: PCI device driver for sparc, sparc64, and i386
To: None <steven_grunza@ieee.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: tech-kern
Date: 02/06/2001 23:17:31
In <3.0.6.32.20010206090136.007df8a0@pop.netzero.net>
steven_grunza@ieee.org wrote:
> I plan on writing a device driver for a PCI card. I would like the same
> source to work on sparc, sparc64, and i386. Are there any issues betwen
> the 32-bit sparc and i386 and the 64-bit sparc64 of which I should be
> aware? I'm expecting to be calling hton and ntoh to deal with the endian
> problems...
Most current PCI device drivers _should_ work on each machines,
including alpha and macppc and all sources are shared.
The endianness is handled by bus_space(9) functions,
htole{16,32}() and le32toh{16,32} macro etc.
Some other quirks are handled /sys/arch/*/pci/pci_machdep.c etc.
> If someone could provide a rough framework for calls necessary to set up
> bus master dma's for a PCI card, that would really be appreciated.
> Specifically, how to allocate memory for the PCI card and get it locked
> (prevent it from being paged out). I realize the details of informing the
> card of the location of this memory (or chunks of memory for
> scatter-gather) are my own problem...
See bus_dma(9) man page and existing drivers under /sys/dev/pci and
/sys/dev/ic, like pci/isp_pci.c and ic/isp*.c etc.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp