|
NAMEofw_bus_is_compatible ,
ofw_bus_is_compatible_strict ,
ofw_bus_node_is_compatible ,
ofw_bus_search_compatible —
check device tree nodes for compatibility with drivers
SYNOPSIS#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include
<dev/ofw/ofw_bus_subr.h>
int
int
int
const struct ofw_compat_data *
DESCRIPTIONThe "compatible" property of the device tree node is used to identify the type of the device the node represents. The property is a list of one or more strings that represent hardware types the device is compatible with. The common format for such strings is "vendor,hardware" where "vendor" is an abbreviated name of the manufacturer and "hardware" is a device identifier, for instance, "fsl" for "Freescale" and "imx6ul-i2c" for the I2C controller. More than one string is required for compatibility with older revisions of the driver. If hardware revision B is backward compatible with revision A device tree node can signal this compatibility by providing both "vndr,hrdwrA" and "vndr,hrdwrB" strings in the "compatibile" property value. This way older driver can use features available only in revision A, and the new version of the driver can take advantage of revision B feature set.
struct ofw_compat_data { const char *ocd_str; uintptr_t ocd_data; }; EXAMPLESstatic struct ofw_compat_data compat_data[] = { {"arm,hrdwrA", FEATURE_A}, {"arm,hrdwrB", FEATURE_A | FEATURE_B}, {NULL, 0} }; static int hrdwr_probe(device_t dev) { ... if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) return (ENXIO); ... } static int hrdwr_attach(device_t dev) { ... sc = device_get_softc(dev); sc->sc_features = ofw_bus_search_compatible(dev, compat_data)->ocd_data; ... } SEE ALSOofw_bus_find_compatible(9)AUTHORSThis manual page was written by Oleksandr Tymoshenko.
Visit the GSP FreeBSD Man Page Interface. |