xref: /freebsd/share/man/man9/device_get_property.9 (revision fa9896e082a1046ff4fbc75fcba4d18d1f2efc19)
13f9a00e3SBartlomiej Grzesik.\" -
2*4d846d26SWarner Losh.\" SPDX-License-Identifier: BSD-2-Clause
33f9a00e3SBartlomiej Grzesik.\"
43f9a00e3SBartlomiej Grzesik.\" Copyright (c) 2021 Semihalf
53f9a00e3SBartlomiej Grzesik.\"
63f9a00e3SBartlomiej Grzesik.\" Redistribution and use in source and binary forms, with or without
73f9a00e3SBartlomiej Grzesik.\" modification, are permitted provided that the following conditions
83f9a00e3SBartlomiej Grzesik.\" are met:
93f9a00e3SBartlomiej Grzesik.\" 1. Redistributions of source code must retain the above copyright
103f9a00e3SBartlomiej Grzesik.\"    notice, this list of conditions and the following disclaimer.
113f9a00e3SBartlomiej Grzesik.\" 2. Redistributions in binary form must reproduce the above copyright
123f9a00e3SBartlomiej Grzesik.\"    notice, this list of conditions and the following disclaimer in the
133f9a00e3SBartlomiej Grzesik.\"    documentation and/or other materials provided with the distribution.
143f9a00e3SBartlomiej Grzesik.\"
153f9a00e3SBartlomiej Grzesik.\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
163f9a00e3SBartlomiej Grzesik.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
173f9a00e3SBartlomiej Grzesik.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
183f9a00e3SBartlomiej Grzesik.\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
193f9a00e3SBartlomiej Grzesik.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
203f9a00e3SBartlomiej Grzesik.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
213f9a00e3SBartlomiej Grzesik.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
223f9a00e3SBartlomiej Grzesik.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
233f9a00e3SBartlomiej Grzesik.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
243f9a00e3SBartlomiej Grzesik.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
253f9a00e3SBartlomiej Grzesik.\"
2699e6980fSBjoern A. Zeeb.Dd September 29, 2022
273f9a00e3SBartlomiej Grzesik.Dt DEVICE_GET_PROPERTY 9
283f9a00e3SBartlomiej Grzesik.Os
293f9a00e3SBartlomiej Grzesik.Sh NAME
303f9a00e3SBartlomiej Grzesik.Nm device_get_property ,
313f9a00e3SBartlomiej Grzesik.Nm device_has_property
323f9a00e3SBartlomiej Grzesik.Nd access device specific data
333f9a00e3SBartlomiej Grzesik.Sh SYNOPSIS
343f9a00e3SBartlomiej Grzesik.In sys/param.h
353f9a00e3SBartlomiej Grzesik.In sys/bus.h
363f9a00e3SBartlomiej Grzesik.Ft ssize_t
37b344de4dSKornel Duleba.Fn device_get_property "device_t dev" "const char *prop" "void *val" "size_t sz" \
38b344de4dSKornel Duleba    "device_property_type_t type"
393f9a00e3SBartlomiej Grzesik.Ft bool
403f9a00e3SBartlomiej Grzesik.Fn device_has_property "device_t dev" "const char *prop"
413f9a00e3SBartlomiej Grzesik.Sh DESCRIPTION
423f9a00e3SBartlomiej GrzesikAccess device specific data provided by the parent bus.
433f9a00e3SBartlomiej GrzesikDrivers can use these properties to obtain device capabilities and set
443f9a00e3SBartlomiej Grzesiknecessary quirks.
45b344de4dSKornel Duleba.Pp
46b344de4dSKornel DulebaThe underlying property type is specified with the
47b344de4dSKornel Duleba.Fa type
48b344de4dSKornel Dulebaargument.
49b344de4dSKornel DulebaCurrently the following types are supported:
50b344de4dSKornel Duleba.Bl -tag -width ".Dv DEVICE_PROP_BUFFER"
51b344de4dSKornel Duleba.It Dv DEVICE_PROP_BUFFER
52b344de4dSKornel DulebaThe underlying property is a string of bytes.
53b344de4dSKornel Duleba.It Dv DEVICE_PROP_ANY
54b344de4dSKornel DulebaWildcard property type.
5599e6980fSBjoern A. Zeeb.It Dv DEVICE_PROP_HANDLE
5699e6980fSBjoern A. ZeebFollowing a reference the underlying property is a handle of the
5799e6980fSBjoern A. Zeebrespective bus.
58b344de4dSKornel Duleba.It Dv DEVICE_PROP_UINT32
59b344de4dSKornel DulebaThe underlying property is an array of unsigned 32 bit integers.
60b344de4dSKornel DulebaThe
61b344de4dSKornel Duleba.Fa sz
62b344de4dSKornel Dulebaargument shall be a multiple of 4.
63b344de4dSKornel Duleba.It Dv DEVICE_PROP_UINT64
64b344de4dSKornel DulebaThe underlying property is an array of unsigned 64 bit integers.
65b344de4dSKornel DulebaThe
66b344de4dSKornel Duleba.Fa sz
67b344de4dSKornel Dulebaargument shall be a multiple of 8.
68b344de4dSKornel Duleba.El
693f9a00e3SBartlomiej Grzesik.Sh NOTES
703f9a00e3SBartlomiej GrzesikYou can pass NULL as pointer to property's value when calling
713f9a00e3SBartlomiej Grzesik.Fn device_get_property
723f9a00e3SBartlomiej Grzesikto obtain its size.
733f9a00e3SBartlomiej Grzesik.Pp
743f9a00e3SBartlomiej GrzesikCurrently this interface is implemented by
753f9a00e3SBartlomiej Grzesik.Xr simplebus 4
763f9a00e3SBartlomiej Grzesikand
773f9a00e3SBartlomiej Grzesik.Xr acpi 4 .
783f9a00e3SBartlomiej Grzesik.Sh RETURN VALUES
793f9a00e3SBartlomiej Grzesik.Fn device_get_property
803f9a00e3SBartlomiej Grzesikif successful returns property's size, otherwise returns -1.
813f9a00e3SBartlomiej Grzesik.Pp
823f9a00e3SBartlomiej Grzesik.Fn device_has_property
833f9a00e3SBartlomiej Grzesikreturns true if given property was found.
843f9a00e3SBartlomiej Grzesik.Sh SEE ALSO
853f9a00e3SBartlomiej Grzesik.Xr acpi 4 ,
863f9a00e3SBartlomiej Grzesik.Xr simplebus 4 ,
873f9a00e3SBartlomiej Grzesik.Xr device 9
883f9a00e3SBartlomiej Grzesik.Sh AUTHORS
893f9a00e3SBartlomiej GrzesikThis manual page was written by
903f9a00e3SBartlomiej Grzesik.An Bartlomiej Grzesik .
91