HomeFreeBSD

Extend device_get_property API

Description

Extend device_get_property API

In order to support various types of data stored in device
tree properties or ACPI _DSD packages, create a new enum so
the caller can specify the expected type of a property they
want to read, according to the binding. The bus logic will use
that information to process the underlying data.

For example in DT all integer properties are stored in BE format.
In order to get constant results across different platforms we
need to convert its endianness to match the host.

Another example are ACPI_TYPE_INTEGER properties stored
as uint64_t. Before this patch the ACPI logic would refuse
to read them if the provided buffer was smaller than 8 bytes.
Now this can be handled by using DEVICE_PROP_UINT32 type.

Modify the existing consumers of this API to reflect the changes
and update the man pages accordingly.

Reviewed by: mw
Obtained from: Semihalf
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D33457

(cherry picked from commit b344de4d0d163cbd8bf88cb5d226c18fe96f488f)

Details

Provenance
kdAuthored on Jan 28 2022, 9:28 AM
mwCommitted on Mar 29 2022, 10:24 PM
Reviewer
mw
Differential Revision
D33457: Expand device_get_property API
Parents
rGa2bd4cd7863c: bus_if: Add a default implementation of get_property
Branches
Unknown
Tags
Unknown