ofw_bus_status_okay(9)

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

✨ ofw_bus_status_okay(9) β€” the device tree vibe check πŸ’…

okay so bestie, welcome to the ofw_bus_status_okay corner of the Kernel Developer's Manual. we're talking about checking the status of a device tree node, and honestly? it's giving "is this device even invited to the party" energy πŸŽ€

✨ SYNOPSIS ✨

first things first, the includes you gotta have, no cap:

#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>

then the three iconic functions themselves:

const char *
ofw_bus_get_status(device_t dev);

int
ofw_bus_status_okay(device_t dev);

int
ofw_bus_node_status_okay(phandle_t node);

🌸 DESCRIPTION 🌸

so the "status" property of a device tree node is literally the thing that tells you whether the device is enabled or not, periodt. here's the tea: multiple hardware versions might be built using the same base System-on-Chip but with a different set of blocks enabled. it's super common to use one SoC device tree and only enable/disable device nodes for the derivative boards 🧚

a device tree node is considered enabled only if it has that "status" property with the value set to either "ok" or "okay" β€” those are the only two values that slay πŸ’–

okay now the three besties one by one:

  • ofw_bus_get_status() returns the value of the "status" property of the device tree node associated with the device dev. but lowkey important: if the node does not have a "status" property, or there's no node associated with the device at all, the function returns NULL. 😭
  • ofw_bus_status_okay() returns 1 if the device tree node associated with the device dev has a "status" property and its value is either "ok" or "okay".
  • ofw_bus_node_status_okay() returns 1 if the device tree node node has a "status" property and its value is either "ok" or "okay".
note the difference bestie: ofw_bus_status_okay() takes a device_t and looks up its node, while ofw_bus_node_status_okay() takes the phandle_t node directly. same vibe check, different starting point πŸ¦‹

πŸ‘‘ AUTHORS πŸ‘‘

this manual page was written by Oleksandr Tymoshenko. absolute icon, we stan 🫢


and that's the whole thing, bestie! this page came from the Debian manual set, dated April 8, 2018, and it's filed under ofw_bus_status_okay(9) in the Kernel Developer's Manual. go check your status property, stay "okay", and slay βœ¨πŸ’œ

πŸ“¦ where this page comes from