1133589Smarius/*-
2133589Smarius * Copyright (c) 2001, 2003 by Thomas Moestl <tmm@FreeBSD.org>
3133589Smarius * Copyright (c) 2004 by Marius Strobl <marius@FreeBSD.org>
4133589Smarius * All rights reserved.
5133589Smarius *
6133589Smarius * Redistribution and use in source and binary forms, with or without
7133589Smarius * modification, are permitted provided that the following conditions
8133589Smarius * are met:
9133589Smarius * 1. Redistributions of source code must retain the above copyright
10133589Smarius *    notice, this list of conditions and the following disclaimer.
11133589Smarius * 2. Redistributions in binary form must reproduce the above copyright
12133589Smarius *    notice, this list of conditions and the following disclaimer in the
13133589Smarius *    documentation and/or other materials provided with the distribution.
14133589Smarius *
15133589Smarius * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
16133589Smarius * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17133589Smarius * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18133589Smarius * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
19133589Smarius * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20133589Smarius * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21133589Smarius * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22133589Smarius * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23133589Smarius * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
24133589Smarius * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25133589Smarius *
26133589Smarius * $FreeBSD$
27133589Smarius */
28133589Smarius
29133589Smarius#ifndef	_DEV_OFW_OFW_BUS_H_
30133589Smarius#define	_DEV_OFW_OFW_BUS_H_
31133589Smarius
32133589Smarius#include <sys/bus.h>
33133589Smarius
34133589Smarius#include <dev/ofw/openfirm.h>
35133589Smarius
36133589Smarius#include "ofw_bus_if.h"
37133589Smarius
38133589Smariusstatic __inline const char *
39133589Smariusofw_bus_get_compat(device_t dev)
40133589Smarius{
41133589Smarius
42133589Smarius	return (OFW_BUS_GET_COMPAT(device_get_parent(dev), dev));
43133589Smarius}
44133589Smarius
45133589Smariusstatic __inline const char *
46133589Smariusofw_bus_get_model(device_t dev)
47133589Smarius{
48133589Smarius
49133589Smarius	return (OFW_BUS_GET_MODEL(device_get_parent(dev), dev));
50133589Smarius}
51133589Smarius
52133589Smariusstatic __inline const char *
53133589Smariusofw_bus_get_name(device_t dev)
54133589Smarius{
55133589Smarius
56133589Smarius	return (OFW_BUS_GET_NAME(device_get_parent(dev), dev));
57133589Smarius}
58133589Smarius
59133589Smariusstatic __inline phandle_t
60133589Smariusofw_bus_get_node(device_t dev)
61133589Smarius{
62133589Smarius
63133589Smarius	return (OFW_BUS_GET_NODE(device_get_parent(dev), dev));
64133589Smarius}
65133589Smarius
66133589Smariusstatic __inline const char *
67133589Smariusofw_bus_get_type(device_t dev)
68133589Smarius{
69133589Smarius
70133589Smarius	return (OFW_BUS_GET_TYPE(device_get_parent(dev), dev));
71133589Smarius}
72133589Smarius
73256994Snwhitehornstatic __inline int
74261351Snwhitehornofw_bus_map_intr(device_t dev, phandle_t iparent, int icells, pcell_t *intr)
75256994Snwhitehorn{
76261351Snwhitehorn	return (OFW_BUS_MAP_INTR(dev, dev, iparent, icells, intr));
77256994Snwhitehorn}
78256994Snwhitehorn
79133589Smarius#endif /* !_DEV_OFW_OFW_BUS_H_ */
80