f00e79c847
driver to support exposing a GEOM device, which can be used to mount Avalon-attached ROMs, reserved areas of DRAM, etc, as a filesystem: commit 9deb1e60eaaaf7a3687e48c58af5efd756f32ec6 Author: Robert N. M. Watson <robert.watson@cl.cam.ac.uk> Date: Sat Mar 5 20:33:12 2016 +0000 Use format strings with make_dev(9) in avgen(4). commit 0bf2176c23e7425bfa042c08a24f8a25fe6d8885 Author: Robert N. M. Watson <robert.watson@cl.cam.ac.uk> Date: Tue Mar 1 10:23:23 2016 +0000 Implement a new "geomio" configuration argument to altera_avgen(4), the generic I/O device we attach to various BERI peripherals. The new option requests that, instead of exposing the underlying device via a special device node in /dev, it instead be exposed via geom(4), allowing it to be used with filesystems. The current implementation does not allow a device to be exposed both for file/mmap and geom, so one of the two models must be selected when configuring it via FDT or device.hints. A typical use of the new option will be: sri-cambridge,geomio = "rw"; MFC after: 1 week Sponsored by: DARPA, AFRL
99 lines
3.2 KiB
C
99 lines
3.2 KiB
C
/*-
|
|
* Copyright (c) 2012, 2016 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$
|
|
*/
|
|
|
|
#ifndef _DEV_ALTERA_AVALON_H_
|
|
#define _DEV_ALTERA_AVALON_H_
|
|
|
|
struct altera_avgen_softc {
|
|
/*
|
|
* Bus-related fields.
|
|
*/
|
|
device_t avg_dev;
|
|
int avg_unit;
|
|
char *avg_name;
|
|
|
|
/*
|
|
* The device node and memory-mapped I/O region.
|
|
*/
|
|
struct cdev *avg_cdev;
|
|
struct resource *avg_res;
|
|
int avg_rid;
|
|
|
|
/*
|
|
* Access properties configured by device.hints.
|
|
*/
|
|
u_int avg_flags;
|
|
u_int avg_width;
|
|
u_int avg_sectorsize;
|
|
|
|
/*
|
|
* disk(9) state, if required for this device.
|
|
*/
|
|
struct disk *avg_disk;
|
|
struct mtx avg_disk_mtx;
|
|
};
|
|
|
|
/*
|
|
* Various flags extracted from device.hints to configure operations on the
|
|
* device.
|
|
*/
|
|
#define ALTERA_AVALON_FLAG_READ 0x01
|
|
#define ALTERA_AVALON_FLAG_WRITE 0x02
|
|
#define ALTERA_AVALON_FLAG_MMAP_READ 0x04
|
|
#define ALTERA_AVALON_FLAG_MMAP_WRITE 0x08
|
|
#define ALTERA_AVALON_FLAG_MMAP_EXEC 0x10
|
|
#define ALTERA_AVALON_FLAG_GEOM_READ 0x20
|
|
#define ALTERA_AVALON_FLAG_GEOM_WRITE 0x40
|
|
|
|
#define ALTERA_AVALON_CHAR_READ 'r'
|
|
#define ALTERA_AVALON_CHAR_WRITE 'w'
|
|
#define ALTERA_AVALON_CHAR_EXEC 'x'
|
|
|
|
#define ALTERA_AVALON_STR_WIDTH "width"
|
|
#define ALTERA_AVALON_STR_FILEIO "fileio"
|
|
#define ALTERA_AVALON_STR_GEOMIO "geomio"
|
|
#define ALTERA_AVALON_STR_MMAPIO "mmapio"
|
|
#define ALTERA_AVALON_STR_DEVNAME "devname"
|
|
#define ALTERA_AVALON_STR_DEVUNIT "devunit"
|
|
|
|
/*
|
|
* Driver setup routines from the bus attachment/teardown.
|
|
*/
|
|
int altera_avgen_attach(struct altera_avgen_softc *sc,
|
|
const char *str_fileio, const char *str_geomio,
|
|
const char *str_mmapio, const char *str_devname, int devunit);
|
|
void altera_avgen_detach(struct altera_avgen_softc *sc);
|
|
|
|
extern devclass_t altera_avgen_devclass;
|
|
|
|
#endif /* _DEV_ALTERA_AVALON_H_ */
|