xref: /freebsd/sys/dev/ofw/ofw_graph.h (revision 95ee2897e98f5d444f26ed2334cc7c439f9c16c6)
19a4eed0bSEmmanuel Vadot /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
39a4eed0bSEmmanuel Vadot  *
49a4eed0bSEmmanuel Vadot  * Copyright (c) 2019 Emmanuel Vadot <manu@FreeBSD.org>
59a4eed0bSEmmanuel Vadot  *
69a4eed0bSEmmanuel Vadot  * Redistribution and use in source and binary forms, with or without
79a4eed0bSEmmanuel Vadot  * modification, are permitted provided that the following conditions
89a4eed0bSEmmanuel Vadot  * are met:
99a4eed0bSEmmanuel Vadot  * 1. Redistributions of source code must retain the above copyright
109a4eed0bSEmmanuel Vadot  *    notice, this list of conditions, and the following disclaimer,
119a4eed0bSEmmanuel Vadot  *    without modification, immediately at the beginning of the file.
129a4eed0bSEmmanuel Vadot  * 2. Redistributions in binary form must reproduce the above copyright
139a4eed0bSEmmanuel Vadot  *    notice, this list of conditions and the following disclaimer in
149a4eed0bSEmmanuel Vadot  *    the documentation and/or other materials provided with the
159a4eed0bSEmmanuel Vadot  *    distribution.
169a4eed0bSEmmanuel Vadot  *
179a4eed0bSEmmanuel Vadot  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
189a4eed0bSEmmanuel Vadot  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
199a4eed0bSEmmanuel Vadot  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
209a4eed0bSEmmanuel Vadot  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
219a4eed0bSEmmanuel Vadot  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
229a4eed0bSEmmanuel Vadot  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
239a4eed0bSEmmanuel Vadot  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
249a4eed0bSEmmanuel Vadot  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
259a4eed0bSEmmanuel Vadot  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
269a4eed0bSEmmanuel Vadot  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
279a4eed0bSEmmanuel Vadot  * SUCH DAMAGE.
289a4eed0bSEmmanuel Vadot  */
299a4eed0bSEmmanuel Vadot 
309a4eed0bSEmmanuel Vadot #ifndef	_OFW_GRAPH_H_
319a4eed0bSEmmanuel Vadot #define	_OFW_GRAPH_H_
329a4eed0bSEmmanuel Vadot 
339a4eed0bSEmmanuel Vadot phandle_t ofw_graph_get_port_by_idx(phandle_t node, uint32_t idx);
349a4eed0bSEmmanuel Vadot phandle_t ofw_graph_get_remote_endpoint(phandle_t endpoint);
359a4eed0bSEmmanuel Vadot size_t ofw_graph_port_get_num_endpoints(phandle_t port);
369a4eed0bSEmmanuel Vadot phandle_t ofw_graph_get_endpoint_by_idx(phandle_t port, uint32_t idx);
379a4eed0bSEmmanuel Vadot phandle_t ofw_graph_get_remote_parent(phandle_t remote);
389a4eed0bSEmmanuel Vadot 
399a4eed0bSEmmanuel Vadot device_t ofw_graph_get_device_by_port_ep(phandle_t node, uint32_t port_id, uint32_t ep_id);
409a4eed0bSEmmanuel Vadot 
419a4eed0bSEmmanuel Vadot #endif /* _OFW_GRAPH_H_ */
42