ofw_graph(9)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

🫢 ofw_graph(9) 🫢

okay so this is the ofw_graph(9) page from the Kernel Developer's Manual β€” and bestie, it’s all about the little helper functions for the graph bindings. group-chat tutorial time πŸ’…βœ¨


🌸 NAME 🌸

ofw_graph, ofw_graph_get_port_by_idx, ofw_graph_port_get_num_endpoints, ofw_graph_get_endpoint_by_idx, ofw_graph_get_remote_endpoint, ofw_graph_get_remote_parent, ofw_graph_get_device_by_port_ep β€” Helpers for the graph bindings πŸŽ€

✨ SYNOPSIS ✨

       #include <dev/ofw/openfirm.h>
       #include <dev/ofw/ofw_graph.h>

       phandle_t
       ofw_graph_get_port_by_idx(phandle_t node, uint32_t idx);

       size_t
       ofw_graph_port_get_num_endpoints(phandle_t port);

       phandle_t
       ofw_graph_get_endpoint_by_idx(phandle_t port, uint32_t idx);

       phandle_t
       ofw_graph_get_remote_endpoint(phandle_t endpoint);

       phandle_t
       ofw_graph_get_remote_parent(phandle_t remote);

       device_t
       ofw_graph_get_device_by_port_ep(phandle_t node, uint32_t port_id,
           uin32_t ep_id);

πŸ’– DESCRIPTION πŸ’–

The ofw_graph functions are helpers to parse the DTS graph bindings. they’re literally the backstage crew for port/endpoint stuff, no cap 🫢

  • ofw_graph_get_port_by_idx() β€” returns the port with id idx. it will first check node named port@idx and then fallback on checking the ports child for a child node matching the id. if no ports matching idx is found the function return 0. okay so, yes: 0 is the β€œnot found” vibe check πŸ’€
  • ofw_graph_port_get_num_endpoints() β€” returns the number of endpoints a port node have. iconic little counter behavior ✨
  • ofw_graph_get_endpoint_by_idx() β€” return the endpoint with id idx. it will first check if there is a single child named endpoint and returns it if there is. if there is multiple endpoints it will check the reg property and returns the correct phandle_t or 0 if none match. very β€œread the room, then read the reg property” energy πŸŽ€
  • ofw_graph_get_remote_endpoint() β€” returns the remote-endpoint property if it exists or 0. simple. slay 🌸
  • ofw_graph_get_remote_parent() β€” returns the device node corresponding to the remote-endpoint phandle or 0 if none. main character device-tree behavior πŸ’…
  • ofw_graph_get_device_by_port_ep() β€” returns the device associated with the port and endpoint or NULL if none. the device driver should have called OF_device_register_xref() before. yes bestie, that call is a prerequisite, not a suggestion πŸ‘‘

⭐ HISTORY ⭐

The ofw_graph functions first appeared in FreeBSD 13.0. the ofw_graph functions and manual page were written by Emmanuel Vadot <manu@FreeBSD.org> 🫢


signing off with the footer tea β˜•: this page is from Debian, dated April 10, 2019. periodt πŸ’–πŸ¦‹

πŸ“¦ where this page comes from