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