xref: /freebsd/lib/libdevctl/devctl.3 (revision 4fbf8e1c2efb16431c174d7a77c23e700af1160b)
164de8019SJohn Baldwin.\"
264de8019SJohn Baldwin.\" Copyright (c) 2014 John Baldwin <jhb@FreeBSD.org>
364de8019SJohn Baldwin.\"
464de8019SJohn Baldwin.\" Redistribution and use in source and binary forms, with or without
564de8019SJohn Baldwin.\" modification, are permitted provided that the following conditions
664de8019SJohn Baldwin.\" are met:
764de8019SJohn Baldwin.\" 1. Redistributions of source code must retain the above copyright
864de8019SJohn Baldwin.\"    notice, this list of conditions and the following disclaimer.
964de8019SJohn Baldwin.\" 2. Redistributions in binary form must reproduce the above copyright
1064de8019SJohn Baldwin.\"    notice, this list of conditions and the following disclaimer in the
1164de8019SJohn Baldwin.\"    documentation and/or other materials provided with the distribution.
1264de8019SJohn Baldwin.\"
1364de8019SJohn Baldwin.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1464de8019SJohn Baldwin.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1564de8019SJohn Baldwin.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1664de8019SJohn Baldwin.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1764de8019SJohn Baldwin.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1864de8019SJohn Baldwin.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1964de8019SJohn Baldwin.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2064de8019SJohn Baldwin.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2164de8019SJohn Baldwin.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2264de8019SJohn Baldwin.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2364de8019SJohn Baldwin.\" SUCH DAMAGE.
2464de8019SJohn Baldwin.\"
2564de8019SJohn Baldwin.\" $FreeBSD$
2664de8019SJohn Baldwin.\"
27*4fbf8e1cSKonstantin Belousov.Dd April 4, 2019
2864de8019SJohn Baldwin.Dt DEVCTL 3
2964de8019SJohn Baldwin.Os
3064de8019SJohn Baldwin.Sh NAME
3164de8019SJohn Baldwin.Nm devctl ,
3264de8019SJohn Baldwin.Nm devctl_attach ,
33e05ec081SJohn Baldwin.Nm devctl_clear_driver ,
3488eb5c50SJohn Baldwin.Nm devctl_delete ,
3564de8019SJohn Baldwin.Nm devctl_detach ,
3664de8019SJohn Baldwin.Nm devctl_disable ,
3764de8019SJohn Baldwin.Nm devctl_enable ,
385fa29797SWarner Losh.Nm devctl_freeze ,
39a907c691SJohn Baldwin.Nm devctl_rescan ,
40*4fbf8e1cSKonstantin Belousov.Nm devctl_reset ,
4164de8019SJohn Baldwin.Nm devctl_resume ,
420fd00e0cSJohn Baldwin.Nm devctl_set_driver ,
435fa29797SWarner Losh.Nm devctl_suspend ,
445fa29797SWarner Losh.Nm devctl_thaw
4564de8019SJohn Baldwin.Nd device control library
4664de8019SJohn Baldwin.Sh LIBRARY
4764de8019SJohn Baldwin.Lb libdevctl
4864de8019SJohn Baldwin.Sh SYNOPSIS
4964de8019SJohn Baldwin.In devctl.h
5064de8019SJohn Baldwin.Ft int
5164de8019SJohn Baldwin.Fn devctl_attach "const char *device"
5264de8019SJohn Baldwin.Ft int
53e05ec081SJohn Baldwin.Fn devctl_clear_driver "const char *device" "bool force"
54e05ec081SJohn Baldwin.Ft int
5588eb5c50SJohn Baldwin.Fn devctl_delete "const char *device" "bool force"
5688eb5c50SJohn Baldwin.Ft int
5764de8019SJohn Baldwin.Fn devctl_detach "const char *device" "bool force"
5864de8019SJohn Baldwin.Ft int
5964de8019SJohn Baldwin.Fn devctl_disable "const char *device" "bool force_detach"
6064de8019SJohn Baldwin.Ft int
6164de8019SJohn Baldwin.Fn devctl_enable "const char *device"
6264de8019SJohn Baldwin.Ft int
635fa29797SWarner Losh.Fn devctl_freeze "void"
645fa29797SWarner Losh.Ft int
65a907c691SJohn Baldwin.Fn devctl_rescan "const char *device"
66a907c691SJohn Baldwin.Ft int
67*4fbf8e1cSKonstantin Belousov.Fn devctl_reset "const char *device" "bool detach"
68*4fbf8e1cSKonstantin Belousov.Ft int
6964de8019SJohn Baldwin.Fn devctl_resume "const char *device"
7064de8019SJohn Baldwin.Ft int
7164de8019SJohn Baldwin.Fn devctl_set_driver "const char *device" "const char *driver" "bool force"
720fd00e0cSJohn Baldwin.Ft int
730fd00e0cSJohn Baldwin.Fn devctl_suspend "const char *device"
745fa29797SWarner Losh.Ft int
755fa29797SWarner Losh.Fn devctl_thaw "void"
7664de8019SJohn Baldwin.Sh DESCRIPTION
7764de8019SJohn BaldwinThe
7864de8019SJohn Baldwin.Nm
7964de8019SJohn Baldwinlibrary adjusts the state of devices in the kernel's internal device
8064de8019SJohn Baldwinhierarchy.
8164de8019SJohn BaldwinEach control operation accepts a
8264de8019SJohn Baldwin.Fa device
8364de8019SJohn Baldwinargument that identifies the device to adjust.
8464de8019SJohn BaldwinThe
8564de8019SJohn Baldwin.Fa device
8664de8019SJohn Baldwinmay be specified as either the name of an existing device or as a
8764de8019SJohn Baldwinbus-specific address.
8864de8019SJohn BaldwinThe following bus-specific address formats are currently supported:
8964de8019SJohn Baldwin.Bl -tag -offset indent
9064de8019SJohn Baldwin.It Sy pci Ns Fa domain Ns : Ns Fa bus Ns : Ns Fa slot Ns : Ns Fa function
9164de8019SJohn BaldwinA PCI device with the specified
9264de8019SJohn Baldwin.Fa domain ,
9364de8019SJohn Baldwin.Fa bus ,
9464de8019SJohn Baldwin.Fa slot ,
9564de8019SJohn Baldwinand
9664de8019SJohn Baldwin.Fa function .
9764de8019SJohn Baldwin.It Sy pci Ns Fa bus Ns : Ns Fa slot Ns : Ns Fa function
9864de8019SJohn BaldwinA PCI device in domain zero with the specified
9964de8019SJohn Baldwin.Fa bus ,
10064de8019SJohn Baldwin.Fa slot ,
10164de8019SJohn Baldwinand
10264de8019SJohn Baldwin.Fa function .
10364de8019SJohn Baldwin.It Fa handle
10464de8019SJohn BaldwinA device with an ACPI handle of
10564de8019SJohn Baldwin.Fa handle .
10664de8019SJohn BaldwinThe handle must be specified as an absolute path and must begin with a
10764de8019SJohn Baldwin.Dq \e .
10864de8019SJohn Baldwin.El
10964de8019SJohn Baldwin.Pp
11064de8019SJohn BaldwinThe
11164de8019SJohn Baldwin.Fn devctl_attach
11264de8019SJohn Baldwinfunction probes a device and attaches a suitable device driver if one is
11364de8019SJohn Baldwinfound.
11464de8019SJohn Baldwin.Pp
11564de8019SJohn BaldwinThe
11664de8019SJohn Baldwin.Fn devctl_detach
11764de8019SJohn Baldwinfunction detaches a device from its current device driver.
11864de8019SJohn BaldwinThe device is left detached until either a new driver for its parent
11964de8019SJohn Baldwinbus is loaded or the device is explicitly probed via
12064de8019SJohn Baldwin.Fn devctl_attach .
12164de8019SJohn BaldwinIf
12264de8019SJohn Baldwin.Fa force
12364de8019SJohn Baldwinis true,
12464de8019SJohn Baldwinthe current device driver will be detached even if the device is busy.
12564de8019SJohn Baldwin.Pp
12664de8019SJohn BaldwinThe
12788eb5c50SJohn Baldwin.Fn devctl_delete
12888eb5c50SJohn Baldwinfunction deletes a device from the device tree.
12988eb5c50SJohn BaldwinNo
13088eb5c50SJohn BaldwinIf
13188eb5c50SJohn Baldwin.Fa force
13288eb5c50SJohn Baldwinis true,
13388eb5c50SJohn Baldwinthe device is deleted even if the device is physically present.
13488eb5c50SJohn Baldwin.Pp
13588eb5c50SJohn BaldwinThe
13664de8019SJohn Baldwin.Fn devctl_disable
13764de8019SJohn Baldwinfunction disables a device.
13864de8019SJohn BaldwinIf the device is currently attached to a device driver,
13964de8019SJohn Baldwinthe device driver will be detached from the device,
14064de8019SJohn Baldwinbut the device will retain its current name.
14164de8019SJohn BaldwinIf
14264de8019SJohn Baldwin.Fa force_detach
14364de8019SJohn Baldwinis true,
14464de8019SJohn Baldwinthe current device driver will be detached even if the device is busy.
14564de8019SJohn BaldwinThe device will remain disabled and detached until it is explicitly enabled
14664de8019SJohn Baldwinvia
14764de8019SJohn Baldwin.Fn devctl_enable .
14864de8019SJohn Baldwin.Pp
14964de8019SJohn BaldwinThe
15064de8019SJohn Baldwin.Fn devctl_enable
15164de8019SJohn Baldwinfunction re-enables a disabled device.
15264de8019SJohn BaldwinThe device will probe and attach if a suitable device driver is found.
15364de8019SJohn Baldwin.Pp
15464de8019SJohn BaldwinThe
15564de8019SJohn Baldwin.Fn devctl_suspend
15664de8019SJohn Baldwinfunction suspends a device.
15764de8019SJohn BaldwinThis may include placing the device in a reduced power state,
15864de8019SJohn Baldwinbut any device driver currently attached to the device will remain attached.
15964de8019SJohn Baldwin.Pp
16064de8019SJohn BaldwinThe
16164de8019SJohn Baldwin.Fn devctl_resume
16264de8019SJohn Baldwinfunction resumes a suspended device to a fully working state.
16364de8019SJohn Baldwin.Pp
16464de8019SJohn BaldwinThe
16564de8019SJohn Baldwin.Fn devctl_set_driver
16664de8019SJohn Baldwinfunction attaches a device driver named
16764de8019SJohn Baldwin.Fa driver
16864de8019SJohn Baldwinto a device.
16964de8019SJohn BaldwinIf the device is already attached and
17064de8019SJohn Baldwin.Fa force
17164de8019SJohn Baldwinis false,
17264de8019SJohn Baldwinthe request will fail.
17364de8019SJohn BaldwinIf the device is already attached and
17464de8019SJohn Baldwin.Fa force
17564de8019SJohn Baldwinis true,
17664de8019SJohn Baldwinthe device will be detached from its current device driver before it is
17764de8019SJohn Baldwinattached to the new device driver.
178a907c691SJohn Baldwin.Pp
179a907c691SJohn BaldwinThe
180e05ec081SJohn Baldwin.Fn devctl_clear_driver
181e05ec081SJohn Baldwinfunction resets a device so that it can be attached to any valid device
182e05ec081SJohn Baldwindriver rather than only drivers with a previously specified name.
183e05ec081SJohn BaldwinThis function is used to undo a previous call to
184e05ec081SJohn Baldwin.Fn devctl_set_driver .
185e05ec081SJohn BaldwinIf the device is already attached and
186e05ec081SJohn Baldwin.Fa force
187e05ec081SJohn Baldwinis false,
188e05ec081SJohn Baldwinthe request will fail.
189e05ec081SJohn BaldwinIf the device is already attached and
190e05ec081SJohn Baldwin.Fa force
191e05ec081SJohn Baldwinis true,
192e05ec081SJohn Baldwinthe device will be detached from its current device driver.
193e05ec081SJohn BaldwinAfter the device's name is reset,
194e05ec081SJohn Baldwinit is reprobed and attached to a suitable device driver if one is found.
195e05ec081SJohn Baldwin.Pp
196e05ec081SJohn BaldwinThe
197a907c691SJohn Baldwin.Fn devctl_rescan
198a907c691SJohn Baldwinfunction rescans a bus device checking for devices that have been added or
199a907c691SJohn Baldwinremoved.
2005fa29797SWarner Losh.Pp
2015fa29797SWarner LoshThe
2025fa29797SWarner Losh.Fn devctl_freeze
2035fa29797SWarner Loshfunction freezes probe and attach processing initiated in response to
2045fa29797SWarner Loshdrivers being loaded.
2055fa29797SWarner Losh.Pp
2065fa29797SWarner LoshThe
2075fa29797SWarner Losh.Fn devctl_thaw
2085fa29797SWarner Loshfunction resumes (thaws the freeze) probe and attach processing
2095fa29797SWarner Loshinitiated in response to drivers being loaded.
210*4fbf8e1cSKonstantin Belousov.Pp
211*4fbf8e1cSKonstantin BelousovThe
212*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
213*4fbf8e1cSKonstantin Belousovfunction resets the specified device using bus-specific reset method.
214*4fbf8e1cSKonstantin BelousovThe
215*4fbf8e1cSKonstantin Belousov.Fa detach
216*4fbf8e1cSKonstantin Belousovargument, if true, specifies that the device driver is detached before
217*4fbf8e1cSKonstantin Belousovthe reset, and re-attached afterwards.
218*4fbf8e1cSKonstantin BelousovIf false, the device is suspended before the reset, and resumed after.
21964de8019SJohn Baldwin.Sh RETURN VALUES
220e05ec081SJohn Baldwin.Rv -std devctl_attach devctl_clear_driver devctl_delete devctl_detach \
221e05ec081SJohn Baldwindevctl_disable devctl_enable devctl_suspend devctl_rescan devctl_resume \
222e05ec081SJohn Baldwindevctl_set_driver
22364de8019SJohn Baldwin.Sh ERRORS
22464de8019SJohn BaldwinIn addition to specific errors noted below,
22564de8019SJohn Baldwinall of the
22664de8019SJohn Baldwin.Nm
22764de8019SJohn Baldwinfunctions may fail for any of the errors described in
22864de8019SJohn Baldwin.Xr open 2
22964de8019SJohn Baldwinas well as:
23064de8019SJohn Baldwin.Bl -tag -width Er
23164de8019SJohn Baldwin.It Bq Er EINVAL
23264de8019SJohn BaldwinThe device name is too long.
23364de8019SJohn Baldwin.It Bq Er ENOENT
23464de8019SJohn BaldwinNo existing device matches the specified name or location.
23564de8019SJohn Baldwin.It Bq Er EPERM
23664de8019SJohn BaldwinThe current process is not permitted to adjust the state of
23764de8019SJohn Baldwin.Fa device .
23864de8019SJohn Baldwin.El
23964de8019SJohn Baldwin.Pp
24064de8019SJohn BaldwinThe
24164de8019SJohn Baldwin.Fn devctl_attach
24264de8019SJohn Baldwinfunction may fail if:
24364de8019SJohn Baldwin.Bl -tag -width Er
24464de8019SJohn Baldwin.It Bq Er EBUSY
24564de8019SJohn BaldwinThe device is already attached.
24664de8019SJohn Baldwin.It Bq Er ENOMEM
24764de8019SJohn BaldwinAn internal memory allocation request failed.
24864de8019SJohn Baldwin.It Bq Er ENXIO
24964de8019SJohn BaldwinThe device is disabled.
25064de8019SJohn Baldwin.It Bq Er ENXIO
25164de8019SJohn BaldwinNo suitable driver for the device could be found,
25264de8019SJohn Baldwinor the driver failed to attach.
25364de8019SJohn Baldwin.El
25464de8019SJohn Baldwin.Pp
25564de8019SJohn BaldwinThe
25664de8019SJohn Baldwin.Fn devctl_detach
25764de8019SJohn Baldwinfunction may fail if:
25864de8019SJohn Baldwin.Bl -tag -width Er
25964de8019SJohn Baldwin.It Bq Er EBUSY
26064de8019SJohn BaldwinThe current device driver for
26164de8019SJohn Baldwin.Fa device
26264de8019SJohn Baldwinis busy and cannot detach at this time.
26364de8019SJohn BaldwinNote that some drivers may return this even if
26464de8019SJohn Baldwin.Fa force
26564de8019SJohn Baldwinis true.
26664de8019SJohn Baldwin.It Bq Er ENXIO
26764de8019SJohn BaldwinThe device is not attached to a driver.
26864de8019SJohn Baldwin.It Bq Er ENXIO
26964de8019SJohn BaldwinThe current device driver for
27064de8019SJohn Baldwin.Fa device
27164de8019SJohn Baldwindoes not support detaching.
27264de8019SJohn Baldwin.El
27364de8019SJohn Baldwin.Pp
27464de8019SJohn BaldwinThe
27564de8019SJohn Baldwin.Fn devctl_enable
27664de8019SJohn Baldwinfunction may fail if:
27764de8019SJohn Baldwin.Bl -tag -width Er
27864de8019SJohn Baldwin.It Bq Er EBUSY
27964de8019SJohn BaldwinThe device is already enabled.
28064de8019SJohn Baldwin.It Bq Er ENOMEM
28164de8019SJohn BaldwinAn internal memory allocation request failed.
28264de8019SJohn Baldwin.It Bq Er ENXIO
28364de8019SJohn BaldwinNo suitable driver for the device could be found,
28464de8019SJohn Baldwinor the driver failed to attach.
28564de8019SJohn Baldwin.El
28664de8019SJohn Baldwin.Pp
28764de8019SJohn BaldwinThe
28864de8019SJohn Baldwin.Fn devctl_disable
28964de8019SJohn Baldwinfunction may fail if:
29064de8019SJohn Baldwin.Bl -tag -width Er
29164de8019SJohn Baldwin.It Bq Er EBUSY
29264de8019SJohn BaldwinThe current device driver for
29364de8019SJohn Baldwin.Fa device
29464de8019SJohn Baldwinis busy and cannot detach at this time.
29564de8019SJohn BaldwinNote that some drivers may return this even if
29664de8019SJohn Baldwin.Fa force_detach
29764de8019SJohn Baldwinis true.
29864de8019SJohn Baldwin.It Bq Er ENXIO
29964de8019SJohn BaldwinThe device is already disabled.
30064de8019SJohn Baldwin.It Bq Er ENXIO
30164de8019SJohn BaldwinThe current device driver for
30264de8019SJohn Baldwin.Fa device
30364de8019SJohn Baldwindoes not support detaching.
30464de8019SJohn Baldwin.El
30564de8019SJohn Baldwin.Pp
30664de8019SJohn BaldwinThe
30764de8019SJohn Baldwin.Fn devctl_suspend
30864de8019SJohn Baldwinfunction may fail if:
30964de8019SJohn Baldwin.Bl -tag -width Er
31064de8019SJohn Baldwin.It Bq Er EBUSY
31164de8019SJohn BaldwinThe device is already suspended.
31264de8019SJohn Baldwin.It Bq Er EINVAL
31364de8019SJohn BaldwinThe device to be suspended is the root bus device.
31464de8019SJohn Baldwin.El
31564de8019SJohn Baldwin.Pp
31664de8019SJohn BaldwinThe
31764de8019SJohn Baldwin.Fn devctl_resume
31864de8019SJohn Baldwinfunction may fail if:
31964de8019SJohn Baldwin.Bl -tag -width Er
32064de8019SJohn Baldwin.It Bq Er EINVAL
32164de8019SJohn BaldwinThe device is not suspended.
32264de8019SJohn Baldwin.It Bq Er EINVAL
32364de8019SJohn BaldwinThe device to be resumed is the root bus device.
32464de8019SJohn Baldwin.El
32564de8019SJohn Baldwin.Pp
32664de8019SJohn BaldwinThe
32764de8019SJohn Baldwin.Fn devctl_set_driver
32864de8019SJohn Baldwinfunction may fail if:
32964de8019SJohn Baldwin.Bl -tag -width Er
33064de8019SJohn Baldwin.It Bq Er EBUSY
33164de8019SJohn BaldwinThe device is currently attached to a device driver and
33264de8019SJohn Baldwin.Fa force
33364de8019SJohn Baldwinis false.
33464de8019SJohn Baldwin.It Bq Er EBUSY
33564de8019SJohn BaldwinThe current device driver for
33664de8019SJohn Baldwin.Fa device
33764de8019SJohn Baldwinis busy and cannot detach at this time.
33864de8019SJohn Baldwin.It Bq Er EFAULT
33964de8019SJohn BaldwinThe
34064de8019SJohn Baldwin.Fa driver
34164de8019SJohn Baldwinargument points outside the process' allocated address space.
34264de8019SJohn Baldwin.It Bq Er ENOENT
34364de8019SJohn BaldwinNo device driver with the requested name exists.
34464de8019SJohn Baldwin.It Bq Er ENOMEM
34564de8019SJohn BaldwinAn internal memory allocation request failed.
34664de8019SJohn Baldwin.It Bq Er ENXIO
34764de8019SJohn BaldwinThe device is disabled.
34864de8019SJohn Baldwin.It Bq Er ENXIO
34964de8019SJohn BaldwinThe new device driver failed to attach.
35064de8019SJohn Baldwin.El
351a907c691SJohn Baldwin.Pp
352a907c691SJohn BaldwinThe
353e05ec081SJohn Baldwin.Fn devctl_clear_driver
354e05ec081SJohn Baldwinfunction may fail if:
355e05ec081SJohn Baldwin.Bl -tag -width Er
356e05ec081SJohn Baldwin.It Bq Er EBUSY
357e05ec081SJohn BaldwinThe device is currently attached to a device driver and
358e05ec081SJohn Baldwin.Fa force
359e05ec081SJohn Baldwinis false.
360e05ec081SJohn Baldwin.It Bq Er EBUSY
361e05ec081SJohn BaldwinThe current device driver for
362e05ec081SJohn Baldwin.Fa device
363e05ec081SJohn Baldwinis busy and cannot detach at this time.
364e05ec081SJohn Baldwin.It Bq Er EINVAL
365e05ec081SJohn BaldwinThe device is not configured for a specific device driver name.
366e05ec081SJohn Baldwin.It Bq Er ENXIO
367e05ec081SJohn BaldwinThe device driver chosen after reprobing failed to attach.
368e05ec081SJohn Baldwin.El
369e05ec081SJohn Baldwin.Pp
370e05ec081SJohn BaldwinThe
371a907c691SJohn Baldwin.Fn devctl_rescan
372a907c691SJohn Baldwinfunction may fail if:
373a907c691SJohn Baldwin.Bl -tag -width Er
374a907c691SJohn Baldwin.It Bq Er ENXIO
375a907c691SJohn BaldwinThe device is not attached to a driver.
376a907c691SJohn Baldwin.It Bq Er ENXIO
377a907c691SJohn BaldwinThe bus driver does not support rescanning.
378a907c691SJohn Baldwin.El
37988eb5c50SJohn Baldwin.Pp
38088eb5c50SJohn BaldwinThe
38188eb5c50SJohn Baldwin.Fn devctl_delete
38288eb5c50SJohn Baldwinfunction may fail if:
38388eb5c50SJohn Baldwin.Bl -tag -width Er
38488eb5c50SJohn Baldwin.It Bq Er EBUSY
38588eb5c50SJohn BaldwinThe device is physically present and
38688eb5c50SJohn Baldwin.Fa force
38788eb5c50SJohn Baldwinis false.
38888eb5c50SJohn Baldwin.It Bq Er EINVAL
38988eb5c50SJohn Baldwin.Fa dev
39088eb5c50SJohn Baldwinis the root device of the device tree.
39188eb5c50SJohn Baldwin.El
392*4fbf8e1cSKonstantin Belousov.Pp
393*4fbf8e1cSKonstantin BelousovThe
394*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
395*4fbf8e1cSKonstantin Belousovfunction may fail if:
396*4fbf8e1cSKonstantin Belousov.Bl -tag -width Er
397*4fbf8e1cSKonstantin Belousov.It Bq Er ENXIO
398*4fbf8e1cSKonstantin BelousovThe bus does not implement the reset method.
399*4fbf8e1cSKonstantin Belousov.It Bq Er ETIMEDOUT
400*4fbf8e1cSKonstantin BelousovThe device failed to respond after the reset in the time limits
401*4fbf8e1cSKonstantin Belousovspecific to the bus.
402*4fbf8e1cSKonstantin Belousov.El
403*4fbf8e1cSKonstantin BelousovThe
404*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
405*4fbf8e1cSKonstantin Belousovfunction may also return errors caused by the attach, detach, suspend,
406*4fbf8e1cSKonstantin Belousovand resume methods of the device driver.
40764de8019SJohn Baldwin.Sh SEE ALSO
40864de8019SJohn Baldwin.Xr devinfo 3 ,
40964de8019SJohn Baldwin.Xr devstat 3 ,
41064de8019SJohn Baldwin.Xr devctl 8
41164de8019SJohn Baldwin.Sh HISTORY
41264de8019SJohn BaldwinThe
41364de8019SJohn Baldwin.Nm
41464de8019SJohn Baldwinlibrary first appeared in
4150fd00e0cSJohn Baldwin.Fx 10.3 .
41664de8019SJohn Baldwin.Sh BUGS
41764de8019SJohn BaldwinIf a device is suspended individually via
41864de8019SJohn Baldwin.Fn devctl_suspend
41964de8019SJohn Baldwinand the entire machine is subsequently suspended,
42064de8019SJohn Baldwinthe device will be resumed when the machine resumes.
421*4fbf8e1cSKonstantin Belousov.Pp
422*4fbf8e1cSKonstantin BelousovSimilarly, if the device is suspended, and
423*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
424*4fbf8e1cSKonstantin Belousovis called on the device with
425*4fbf8e1cSKonstantin Belousov.Fa detach
426*4fbf8e1cSKonstantin Belousovset to
427*4fbf8e1cSKonstantin Belousov.Va false ,
428*4fbf8e1cSKonstantin Belousovthe device is resumed by the
429*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
430*4fbf8e1cSKonstantin Belousovcall.
431*4fbf8e1cSKonstantin BelousovOr, if the driver for the device is detached manually, and
432*4fbf8e1cSKonstantin Belousov.Fn devctl_reset
433*4fbf8e1cSKonstantin Belousovis called on the device with
434*4fbf8e1cSKonstantin Belousov.Fa detach
435*4fbf8e1cSKonstantin Belousovset to
436*4fbf8e1cSKonstantin Belousov.Va true ,
437*4fbf8e1cSKonstantin Belousovdevice reset re-attaches the driver.
438