Add altera_avgen(4), a generic device driver to be used by hard and soft
CPU cores on Altera FPGAs. The device driver allows memory-mapped devices
on Altera's Avalon SoC bus to be exported to userspace via device nodes.
device.hints directories dictate device name, permissible access methods,
physical address and length, and I/O alignment. Devices can be accessed
using read(2)/write(2), but also memory mapped in userspace using mmap(2).
Devices attach directly to the Nexus, as is common for embedded device
drivers; in the future something more mature might be desirable. There is
currently no facility to support directing device-originated interrupts to
userspace.
In the future, this device driver may be renamed to socgen(4), as it can
in principle also be used with other system-on-chip (SoC) busses, such as
Axi on ASICs and FPGAs. However, we have only tested it on Avalon busses
with memory-mapped ROMs, frame buffers, etc.
Sponsored by: DARPA, AFRL
2012-08-25 11:07:43 +00:00
|
|
|
.\"-
|
|
|
|
.\" Copyright (c) 2012 Robert N. M. Watson
|
|
|
|
.\" All rights reserved.
|
|
|
|
.\"
|
|
|
|
.\" This software was developed by SRI International and the University of
|
|
|
|
.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
|
|
|
|
.\" ("CTSRD"), as part of the DARPA CRASH research programme.
|
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
|
|
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
|
|
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
|
|
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
|
|
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
|
|
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
|
|
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
.\" SUCH DAMAGE.
|
|
|
|
.\"
|
|
|
|
.\" $FreeBSD$
|
|
|
|
.\"
|
|
|
|
.Dd August 18, 2012
|
|
|
|
.Dt ALTERA_AVGEN 4
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm altera_avgen
|
|
|
|
.Nd driver for generic Altera Avalon-bus-attached, memory-mapped devices
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Cd "device altera_avgen"
|
|
|
|
.Pp
|
|
|
|
In
|
|
|
|
.Pa /boot/device.hints :
|
|
|
|
.Cd hint.altera_avgen.0.at="nexus0"
|
|
|
|
.Cd hint.altera_avgen.0.maddr=0x7f00a000
|
|
|
|
.Cd hint.altera_avgen.0.msize=20
|
|
|
|
.Cd hint.altera_avgen.0.width=4
|
|
|
|
.Cd hint.altera_avgen.0.fileio="rw"
|
|
|
|
.Cd hint.altera_avgen.0.devname="berirom"
|
|
|
|
.Sh DESCRIPTION
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
device driver provides generic support for memory-mapped devices on the
|
|
|
|
Altera Avalon bus.
|
|
|
|
.Pa device.hints
|
|
|
|
entries configure the address, size, I/O disposition, and
|
|
|
|
.Pa /dev
|
|
|
|
device node name that will be used.
|
|
|
|
The
|
2013-10-07 16:49:53 +00:00
|
|
|
.Xr open 2 ,
|
|
|
|
.Xr read 2 ,
|
|
|
|
.Xr write 2 ,
|
Add altera_avgen(4), a generic device driver to be used by hard and soft
CPU cores on Altera FPGAs. The device driver allows memory-mapped devices
on Altera's Avalon SoC bus to be exported to userspace via device nodes.
device.hints directories dictate device name, permissible access methods,
physical address and length, and I/O alignment. Devices can be accessed
using read(2)/write(2), but also memory mapped in userspace using mmap(2).
Devices attach directly to the Nexus, as is common for embedded device
drivers; in the future something more mature might be desirable. There is
currently no facility to support directing device-originated interrupts to
userspace.
In the future, this device driver may be renamed to socgen(4), as it can
in principle also be used with other system-on-chip (SoC) busses, such as
Axi on ASICs and FPGAs. However, we have only tested it on Avalon busses
with memory-mapped ROMs, frame buffers, etc.
Sponsored by: DARPA, AFRL
2012-08-25 11:07:43 +00:00
|
|
|
and
|
2013-10-07 16:49:53 +00:00
|
|
|
.Xr mmap 2
|
Add altera_avgen(4), a generic device driver to be used by hard and soft
CPU cores on Altera FPGAs. The device driver allows memory-mapped devices
on Altera's Avalon SoC bus to be exported to userspace via device nodes.
device.hints directories dictate device name, permissible access methods,
physical address and length, and I/O alignment. Devices can be accessed
using read(2)/write(2), but also memory mapped in userspace using mmap(2).
Devices attach directly to the Nexus, as is common for embedded device
drivers; in the future something more mature might be desirable. There is
currently no facility to support directing device-originated interrupts to
userspace.
In the future, this device driver may be renamed to socgen(4), as it can
in principle also be used with other system-on-chip (SoC) busses, such as
Axi on ASICs and FPGAs. However, we have only tested it on Avalon busses
with memory-mapped ROMs, frame buffers, etc.
Sponsored by: DARPA, AFRL
2012-08-25 11:07:43 +00:00
|
|
|
system calls (and variations) may be used on
|
|
|
|
.Nm
|
|
|
|
device nodes, subject to constraints imposed using
|
|
|
|
.Pa device.hints
|
|
|
|
entries.
|
|
|
|
Although reading and writing mapped memory is supported,
|
|
|
|
.Nm
|
|
|
|
does not currently support directing device interrupts to userspace.
|
|
|
|
.Pp
|
|
|
|
A number of
|
|
|
|
.Pa device.hints
|
|
|
|
sub-fields are available to configure
|
|
|
|
.Nm
|
|
|
|
device instances:
|
|
|
|
.Bl -tag -width devunit
|
|
|
|
.It maddr
|
|
|
|
base physical address of the memory region to export; must be aligned to
|
|
|
|
.Li width
|
2012-08-25 11:34:55 +00:00
|
|
|
.It msize
|
Add altera_avgen(4), a generic device driver to be used by hard and soft
CPU cores on Altera FPGAs. The device driver allows memory-mapped devices
on Altera's Avalon SoC bus to be exported to userspace via device nodes.
device.hints directories dictate device name, permissible access methods,
physical address and length, and I/O alignment. Devices can be accessed
using read(2)/write(2), but also memory mapped in userspace using mmap(2).
Devices attach directly to the Nexus, as is common for embedded device
drivers; in the future something more mature might be desirable. There is
currently no facility to support directing device-originated interrupts to
userspace.
In the future, this device driver may be renamed to socgen(4), as it can
in principle also be used with other system-on-chip (SoC) busses, such as
Axi on ASICs and FPGAs. However, we have only tested it on Avalon busses
with memory-mapped ROMs, frame buffers, etc.
Sponsored by: DARPA, AFRL
2012-08-25 11:07:43 +00:00
|
|
|
length of the memory region export; must be aligned to
|
|
|
|
.Li width
|
|
|
|
.It width
|
|
|
|
Granularity at which
|
|
|
|
.Xr read 2
|
|
|
|
and
|
|
|
|
.Xr write 2
|
|
|
|
operations will be performed.
|
|
|
|
Larger requests will be broken down into
|
|
|
|
.Li width -sized
|
|
|
|
operations; smaller requests will be rejected.
|
|
|
|
I/O operations must be aligned to
|
|
|
|
.Li width .
|
|
|
|
.It fileio
|
|
|
|
allowed file descriptor operations;
|
|
|
|
.Li r
|
|
|
|
authorizes
|
|
|
|
.Xr read 2 ;
|
|
|
|
.Li w
|
|
|
|
authorizes
|
|
|
|
.Xr write 2 .
|
|
|
|
.It mmapio
|
|
|
|
allowed
|
|
|
|
.Xr mmap 2
|
|
|
|
permissions;
|
|
|
|
.Li w
|
|
|
|
authorizes
|
|
|
|
.Dv PROT_WRITE ;
|
|
|
|
.Li r
|
|
|
|
authorizes
|
|
|
|
.Dv PROT_READ ;
|
|
|
|
.Li x
|
|
|
|
authorizes
|
|
|
|
.Dv PROT_EXEC .
|
|
|
|
.It devname
|
|
|
|
specifies a device name relative to
|
|
|
|
.Pa /dev .
|
|
|
|
.It devunit
|
|
|
|
specifies a device unit number; no unit number is used if this is unspecified.
|
|
|
|
.El
|
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr mmap 2 ,
|
|
|
|
.Xr open 2 ,
|
|
|
|
.Xr read 2 ,
|
|
|
|
.Xr write 2
|
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
device driver first appeared in
|
|
|
|
.Fx 10.0 .
|
|
|
|
.Sh AUTHORS
|
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
device driver and this manual page were
|
|
|
|
developed by SRI International and the University of Cambridge Computer
|
|
|
|
Laboratory under DARPA/AFRL contract
|
|
|
|
.Pq FA8750-10-C-0237
|
|
|
|
.Pq Do CTSRD Dc ,
|
|
|
|
as part of the DARPA CRASH research programme.
|
|
|
|
This device driver was written by
|
|
|
|
.An Robert N. M. Watson .
|
|
|
|
.Sh BUGS
|
|
|
|
.Nm
|
|
|
|
is intended to support the writing of userspace device drivers; however, it
|
|
|
|
does not permit directing interrupts to userspace, only memory-mapped I/O.
|
|
|
|
.Pp
|
|
|
|
.Nm
|
|
|
|
supports only a
|
|
|
|
.Li nexus
|
|
|
|
bus attachment, which is appropriate for system-on-chip busses such as
|
|
|
|
Altera's Avalon bus.
|
|
|
|
If the target device is off of another bus type, then additional bus
|
|
|
|
attachments will be required.
|