1*67fb10f3SMarcel Moolenaar /*- 2*67fb10f3SMarcel Moolenaar * Copyright (c) 2014 Marcel Moolenaar 3*67fb10f3SMarcel Moolenaar * All rights reserved. 4*67fb10f3SMarcel Moolenaar * 5*67fb10f3SMarcel Moolenaar * Redistribution and use in source and binary forms, with or without 6*67fb10f3SMarcel Moolenaar * modification, are permitted provided that the following conditions 7*67fb10f3SMarcel Moolenaar * are met: 8*67fb10f3SMarcel Moolenaar * 9*67fb10f3SMarcel Moolenaar * 1. Redistributions of source code must retain the above copyright 10*67fb10f3SMarcel Moolenaar * notice, this list of conditions and the following disclaimer. 11*67fb10f3SMarcel Moolenaar * 2. Redistributions in binary form must reproduce the above copyright 12*67fb10f3SMarcel Moolenaar * notice, this list of conditions and the following disclaimer in the 13*67fb10f3SMarcel Moolenaar * documentation and/or other materials provided with the distribution. 14*67fb10f3SMarcel Moolenaar * 15*67fb10f3SMarcel Moolenaar * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16*67fb10f3SMarcel Moolenaar * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17*67fb10f3SMarcel Moolenaar * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18*67fb10f3SMarcel Moolenaar * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19*67fb10f3SMarcel Moolenaar * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20*67fb10f3SMarcel Moolenaar * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21*67fb10f3SMarcel Moolenaar * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22*67fb10f3SMarcel Moolenaar * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23*67fb10f3SMarcel Moolenaar * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24*67fb10f3SMarcel Moolenaar * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25*67fb10f3SMarcel Moolenaar * 26*67fb10f3SMarcel Moolenaar * $FreeBSD$ 27*67fb10f3SMarcel Moolenaar */ 28*67fb10f3SMarcel Moolenaar 29*67fb10f3SMarcel Moolenaar #ifndef _DEV_PROTO_H_ 30*67fb10f3SMarcel Moolenaar #define _DEV_PROTO_H_ 31*67fb10f3SMarcel Moolenaar 32*67fb10f3SMarcel Moolenaar #define PROTO_RES_MAX 16 33*67fb10f3SMarcel Moolenaar 34*67fb10f3SMarcel Moolenaar #define PROTO_RES_UNUSED 0 35*67fb10f3SMarcel Moolenaar #define PROTO_RES_PCICFG 10 36*67fb10f3SMarcel Moolenaar 37*67fb10f3SMarcel Moolenaar struct proto_res { 38*67fb10f3SMarcel Moolenaar int r_type; 39*67fb10f3SMarcel Moolenaar int r_rid; 40*67fb10f3SMarcel Moolenaar struct resource *r_res; 41*67fb10f3SMarcel Moolenaar u_long r_size; 42*67fb10f3SMarcel Moolenaar union { 43*67fb10f3SMarcel Moolenaar void *cookie; 44*67fb10f3SMarcel Moolenaar struct cdev *cdev; 45*67fb10f3SMarcel Moolenaar } r_u; 46*67fb10f3SMarcel Moolenaar uintptr_t r_opened; 47*67fb10f3SMarcel Moolenaar }; 48*67fb10f3SMarcel Moolenaar 49*67fb10f3SMarcel Moolenaar struct proto_softc { 50*67fb10f3SMarcel Moolenaar device_t sc_dev; 51*67fb10f3SMarcel Moolenaar struct proto_res sc_res[PROTO_RES_MAX]; 52*67fb10f3SMarcel Moolenaar int sc_rescnt; 53*67fb10f3SMarcel Moolenaar }; 54*67fb10f3SMarcel Moolenaar 55*67fb10f3SMarcel Moolenaar extern devclass_t proto_devclass; 56*67fb10f3SMarcel Moolenaar extern char proto_driver_name[]; 57*67fb10f3SMarcel Moolenaar 58*67fb10f3SMarcel Moolenaar int proto_add_resource(struct proto_softc *, int, int, struct resource *); 59*67fb10f3SMarcel Moolenaar 60*67fb10f3SMarcel Moolenaar int proto_attach(device_t dev); 61*67fb10f3SMarcel Moolenaar int proto_detach(device_t dev); 62*67fb10f3SMarcel Moolenaar 63*67fb10f3SMarcel Moolenaar #endif /* _DEV_PROTO_H_ */ 64