1.\"- 2.\" Copyright (c) 2012 Robert N. M. Watson 3.\" All rights reserved. 4.\" 5.\" This software was developed by SRI International and the University of 6.\" Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 7.\" ("CTSRD"), as part of the DARPA CRASH research programme. 8.\" 9.\" Redistribution and use in source and binary forms, with or without 10.\" modification, are permitted provided that the following conditions 11.\" are met: 12.\" 1. Redistributions of source code must retain the above copyright 13.\" notice, this list of conditions and the following disclaimer. 14.\" 2. Redistributions in binary form must reproduce the above copyright 15.\" notice, this list of conditions and the following disclaimer in the 16.\" documentation and/or other materials provided with the distribution. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" $FreeBSD$ 31.\" 32.Dd August 18, 2012 33.Dt ALTERA_AVGEN 4 34.Os 35.Sh NAME 36.Nm altera_avgen 37.Nd driver for generic Altera Avalon-bus-attached, memory-mapped devices 38.Sh SYNOPSIS 39.Cd "device altera_avgen" 40.Pp 41In 42.Pa /boot/device.hints : 43.Cd hint.altera_avgen.0.at="nexus0" 44.Cd hint.altera_avgen.0.maddr=0x7f00a000 45.Cd hint.altera_avgen.0.msize=20 46.Cd hint.altera_avgen.0.width=4 47.Cd hint.altera_avgen.0.fileio="rw" 48.Cd hint.altera_avgen.0.devname="berirom" 49.Sh DESCRIPTION 50The 51.Nm 52device driver provides generic support for memory-mapped devices on the 53Altera Avalon bus. 54.Pa device.hints 55entries configure the address, size, I/O disposition, and 56.Pa /dev 57device node name that will be used. 58The 59.Xr open 2 , 60.Xr read 2 , 61.Xr write 2 , 62and 63.Xr mmap 2 64system calls (and variations) may be used on 65.Nm 66device nodes, subject to constraints imposed using 67.Pa device.hints 68entries. 69Although reading and writing mapped memory is supported, 70.Nm 71does not currently support directing device interrupts to userspace. 72.Pp 73A number of 74.Pa device.hints 75sub-fields are available to configure 76.Nm 77device instances: 78.Bl -tag -width devunit 79.It maddr 80base physical address of the memory region to export; must be aligned to 81.Li width 82.It msize 83length of the memory region export; must be aligned to 84.Li width 85.It width 86Granularity at which 87.Xr read 2 88and 89.Xr write 2 90operations will be performed. 91Larger requests will be broken down into 92.Li width -sized 93operations; smaller requests will be rejected. 94I/O operations must be aligned to 95.Li width . 96.It fileio 97allowed file descriptor operations; 98.Li r 99authorizes 100.Xr read 2 ; 101.Li w 102authorizes 103.Xr write 2 . 104.It mmapio 105allowed 106.Xr mmap 2 107permissions; 108.Li w 109authorizes 110.Dv PROT_WRITE ; 111.Li r 112authorizes 113.Dv PROT_READ ; 114.Li x 115authorizes 116.Dv PROT_EXEC . 117.It devname 118specifies a device name relative to 119.Pa /dev . 120.It devunit 121specifies a device unit number; no unit number is used if this is unspecified. 122.El 123.Sh SEE ALSO 124.Xr mmap 2 , 125.Xr open 2 , 126.Xr read 2 , 127.Xr write 2 128.Sh HISTORY 129The 130.Nm 131device driver first appeared in 132.Fx 10.0 . 133.Sh AUTHORS 134The 135.Nm 136device driver and this manual page were 137developed by SRI International and the University of Cambridge Computer 138Laboratory under DARPA/AFRL contract 139.Pq FA8750-10-C-0237 140.Pq Do CTSRD Dc , 141as part of the DARPA CRASH research programme. 142This device driver was written by 143.An Robert N. M. Watson . 144.Sh BUGS 145.Nm 146is intended to support the writing of userspace device drivers; however, it 147does not permit directing interrupts to userspace, only memory-mapped I/O. 148.Pp 149.Nm 150supports only a 151.Li nexus 152bus attachment, which is appropriate for system-on-chip busses such as 153Altera's Avalon bus. 154If the target device is off of another bus type, then additional bus 155attachments will be required. 156