1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org> 5 * Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org> 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 26 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * 28 * $FreeBSD$ 29 */ 30 31 #ifndef _DEV_OFW_OFW_BUS_H_ 32 #define _DEV_OFW_OFW_BUS_H_ 33 34 #include <sys/bus.h> 35 36 #include <dev/ofw/openfirm.h> 37 38 #include "ofw_bus_if.h" 39 40 static __inline const char * 41 ofw_bus_get_compat(device_t dev) 42 { 43 44 return (OFW_BUS_GET_COMPAT(device_get_parent(dev), dev)); 45 } 46 47 static __inline const char * 48 ofw_bus_get_model(device_t dev) 49 { 50 51 return (OFW_BUS_GET_MODEL(device_get_parent(dev), dev)); 52 } 53 54 static __inline const char * 55 ofw_bus_get_name(device_t dev) 56 { 57 58 return (OFW_BUS_GET_NAME(device_get_parent(dev), dev)); 59 } 60 61 static __inline phandle_t 62 ofw_bus_get_node(device_t dev) 63 { 64 65 return (OFW_BUS_GET_NODE(device_get_parent(dev), dev)); 66 } 67 68 static __inline const char * 69 ofw_bus_get_type(device_t dev) 70 { 71 72 return (OFW_BUS_GET_TYPE(device_get_parent(dev), dev)); 73 } 74 75 static __inline int 76 ofw_bus_map_intr(device_t dev, phandle_t iparent, int icells, pcell_t *intr) 77 { 78 return (OFW_BUS_MAP_INTR(dev, dev, iparent, icells, intr)); 79 } 80 81 #endif /* !_DEV_OFW_OFW_BUS_H_ */ 82