blob: 3f04803ce2ffe0924a1fc04288dd8ddbba042da3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
<table class="head">
<tr>
<td class="head-ltitle">ofw_graph(9)</td>
<td class="head-vol">Kernel Developer's Manual</td>
<td class="head-rtitle">ofw_graph(9)</td>
</tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">ofw_graph</code>,
<code class="Nm">ofw_graph_get_port_by_idx</code>,
<code class="Nm">ofw_graph_port_get_num_endpoints</code>,
<code class="Nm">ofw_graph_get_endpoint_by_idx</code>,
<code class="Nm">ofw_graph_get_remote_endpoint</code>,
<code class="Nm">ofw_graph_get_remote_parent</code>,
<code class="Nm">ofw_graph_get_device_by_port_ep</code> —
<span class="Nd">Helpers for the graph bindings</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
<<a class="In">dev/ofw/openfirm.h</a>></code>
<br/>
<code class="In">#include
<<a class="In">dev/ofw/ofw_graph.h</a>></code></p>
<p class="Pp"><var class="Ft">phandle_t</var>
<br/>
<code class="Fn">ofw_graph_get_port_by_idx</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
node</var>, <var class="Fa" style="white-space: nowrap;">uint32_t
idx</var>);</p>
<p class="Pp"><var class="Ft">size_t</var>
<br/>
<code class="Fn">ofw_graph_port_get_num_endpoints</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
port</var>);</p>
<p class="Pp"><var class="Ft">phandle_t</var>
<br/>
<code class="Fn">ofw_graph_get_endpoint_by_idx</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
port</var>, <var class="Fa" style="white-space: nowrap;">uint32_t
idx</var>);</p>
<p class="Pp"><var class="Ft">phandle_t</var>
<br/>
<code class="Fn">ofw_graph_get_remote_endpoint</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
endpoint</var>);</p>
<p class="Pp"><var class="Ft">phandle_t</var>
<br/>
<code class="Fn">ofw_graph_get_remote_parent</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
remote</var>);</p>
<p class="Pp"><var class="Ft">device_t</var>
<br/>
<code class="Fn">ofw_graph_get_device_by_port_ep</code>(<var class="Fa" style="white-space: nowrap;">phandle_t
node</var>, <var class="Fa" style="white-space: nowrap;">uint32_t
port_id</var>, <var class="Fa" style="white-space: nowrap;">uin32_t
ep_id</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The ofw_graph functions are helpers to parse the DTS graph
bindings</p>
<p class="Pp" id="ofw_graph_get_port_by_idx"><a class="permalink" href="#ofw_graph_get_port_by_idx"><code class="Fn">ofw_graph_get_port_by_idx</code></a>()
return the port with id <var class="Fa">idx</var>. It will first check node
named <var class="Fa">port@idx</var> and then fallback on checking the
<var class="Fa">ports</var> child for a child node matching the id. If no
ports matching <var class="Fa">idx</var> is found the function return 0.</p>
<p class="Pp" id="ofw_graph_port_get_num_endpoints"><a class="permalink" href="#ofw_graph_port_get_num_endpoints"><code class="Fn">ofw_graph_port_get_num_endpoints</code></a>()
returns the number of endpoints a port node have.</p>
<p class="Pp" id="ofw_graph_get_endpoint_by_idx"><a class="permalink" href="#ofw_graph_get_endpoint_by_idx"><code class="Fn">ofw_graph_get_endpoint_by_idx</code></a>()
return the endpoint with id <var class="Fa">idx</var>. It will first check
if there is a single child named <var class="Fa">endpoint</var> and returns
it if there is. If there is multiple endpoints it will check the
<var class="Fa">reg</var> property and returns the correct
<var class="Fa">phandle_t</var> or 0 if none match.</p>
<p class="Pp" id="ofw_graph_get_remote_endpoint"><a class="permalink" href="#ofw_graph_get_remote_endpoint"><code class="Fn">ofw_graph_get_remote_endpoint</code></a>()
returns the <var class="Fa">remote-endpoint</var> property if it exists or
0.</p>
<p class="Pp" id="ofw_graph_get_remote_parent"><a class="permalink" href="#ofw_graph_get_remote_parent"><code class="Fn">ofw_graph_get_remote_parent</code></a>()
returns the device node corresponding to the
<var class="Fa">remote-endpoint</var> phandle or 0 if none.
<a class="permalink" href="#ofw_graph_get_device_by_port_ep"><code class="Fn" id="ofw_graph_get_device_by_port_ep">ofw_graph_get_device_by_port_ep</code></a>()
returns the device associated with the port and endpoint or
<var class="Fa">NULL</var> if none. The device driver should have called
<a class="permalink" href="#OF_device_register_xref"><code class="Fn" id="OF_device_register_xref">OF_device_register_xref</code></a>()
before.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp">The <code class="Nm">ofw_graph</code> functions first appeared in
<span class="Ux">FreeBSD 13.0</span>. The <code class="Nm">ofw_graph</code>
functions and manual page were written by <span class="An">Emmanuel
Vadot</span>
<<a class="Mt" href="mailto:manu@FreeBSD.org">manu@FreeBSD.org</a>>.</p>
</section>
</div>
<table class="foot">
<tr>
<td class="foot-date">April 10, 2019</td>
<td class="foot-os">FreeBSD 15.0</td>
</tr>
</table>
|