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