ofw_bus.h revision 265969
11541Srgrimes/*- 21541Srgrimes * Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org> 31541Srgrimes * Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org> 41541Srgrimes * All rights reserved. 51541Srgrimes * 61541Srgrimes * Redistribution and use in source and binary forms, with or without 71541Srgrimes * modification, are permitted provided that the following conditions 81541Srgrimes * are met: 91541Srgrimes * 1. Redistributions of source code must retain the above copyright 101541Srgrimes * notice, this list of conditions and the following disclaimer. 111541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 121541Srgrimes * notice, this list of conditions and the following disclaimer in the 131541Srgrimes * documentation and/or other materials provided with the distribution. 141541Srgrimes * 151541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 161541Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 171541Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 181541Srgrimes * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 191541Srgrimes * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 201541Srgrimes * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 211541Srgrimes * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 221541Srgrimes * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 231541Srgrimes * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 241541Srgrimes * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 251541Srgrimes * 261541Srgrimes * $FreeBSD: stable/10/sys/dev/ofw/ofw_bus.h 265969 2014-05-13 18:06:26Z ian $ 271541Srgrimes */ 281541Srgrimes 291541Srgrimes#ifndef _DEV_OFW_OFW_BUS_H_ 301541Srgrimes#define _DEV_OFW_OFW_BUS_H_ 311541Srgrimes 321541Srgrimes#include <sys/bus.h> 331541Srgrimes 341541Srgrimes#include <dev/ofw/openfirm.h> 351541Srgrimes 361541Srgrimes#include "ofw_bus_if.h" 37116182Sobrien 38116182Sobrienstatic __inline const char * 391541Srgrimesofw_bus_get_compat(device_t dev) 401541Srgrimes{ 412112Swollman 422946Swollman return (OFW_BUS_GET_COMPAT(device_get_parent(dev), dev)); 431541Srgrimes} 4438869Sbde 451541Srgrimesstatic __inline const char * 461541Srgrimesofw_bus_get_model(device_t dev) 471541Srgrimes{ 4812577Sbde 4930354Sphk return (OFW_BUS_GET_MODEL(device_get_parent(dev), dev)); 5030354Sphk} 5110358Sjulian 5269664Speterstatic __inline const char * 5329653Sdysonofw_bus_get_name(device_t dev) 5469664Speter{ 5591690Seivind 5691690Seivind return (OFW_BUS_GET_NAME(device_get_parent(dev), dev)); 5791690Seivind} 5891690Seivind 5991690Seivindstatic __inline phandle_t 60132710Sphkofw_bus_get_node(device_t dev) 6152780Smsmith{ 6252780Smsmith 63135279Sphk return (OFW_BUS_GET_NODE(device_get_parent(dev), dev)); 64135279Sphk} 65135279Sphk 66135279Sphkstatic __inline const char * 67135279Sphkofw_bus_get_type(device_t dev) 68135279Sphk{ 69135279Sphk 701541Srgrimes return (OFW_BUS_GET_TYPE(device_get_parent(dev), dev)); 711541Srgrimes} 721541Srgrimes 731541Srgrimesstatic __inline int 741541Srgrimesofw_bus_map_intr(device_t dev, phandle_t iparent, int irq) 751541Srgrimes{ 761541Srgrimes return (OFW_BUS_MAP_INTR(dev, dev, iparent, irq)); 771541Srgrimes} 781541Srgrimes 791541Srgrimesstatic __inline int 801541Srgrimesofw_bus_config_intr(device_t dev, int irq, int sense) 811541Srgrimes{ 821541Srgrimes return (OFW_BUS_CONFIG_INTR(dev, dev, irq, sense)); 831541Srgrimes} 841541Srgrimes 8541056Speter#endif /* !_DEV_OFW_OFW_BUS_H_ */ 86138290Sphk