HomeFreeBSD

device: add device_get_property and device_has_property

Description

device: add device_get_property and device_has_property

Generialize bus specific property accessors. Those functions allow driver code
to access device specific information.

Currently there is only support for FDT and ACPI buses.

Reviewed by: manu, mw
Sponsored by: Semihalf
Differential revision: https://reviews.freebsd.org/D31597

(cherry picked from commit 3f9a00e3b577dcca57e331842e0baf2dbdf9325f)

acpi: Fix error code returned in acpi_bus_get_prop

ACPI implementation of device_get_property would return "-1" when
property was found, but it's type wasn't supported.
This causes device_has_property to return false in that scenario, which
arguably could be considered as incorrect.

Fix that by returning "0" in that case.

Reviewed by: bz, mw
Tested by: mw
MFC after: 2 weeks
Obtained from: Semihalf
Differential Revision: https://reviews.freebsd.org/D33103

(cherry picked from commit d9ed1dcc5c6894e376e6e4ef6f2554dd056baf4e)

Details

Provenance
bag_semihalf.comAuthored on Jul 30 2021, 8:57 AM
mwCommitted on Mar 29 2022, 10:24 PM
Reviewer
manu
Differential Revision
D31597: device: add device_get_property and device_has_property
Parents
rGfd08253cdcec: acpica: add ACPI_GET_PROPERTY to access Device Specific Data (DSD)
Branches
Unknown
Tags
Unknown