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.\" 254fbf8e1cSKonstantin Belousov.Dd April 4, 2019 2664de8019SJohn Baldwin.Dt DEVCTL 3 2764de8019SJohn Baldwin.Os 2864de8019SJohn Baldwin.Sh NAME 2964de8019SJohn Baldwin.Nm devctl , 3064de8019SJohn Baldwin.Nm devctl_attach , 31e05ec081SJohn Baldwin.Nm devctl_clear_driver , 3288eb5c50SJohn Baldwin.Nm devctl_delete , 3364de8019SJohn Baldwin.Nm devctl_detach , 3464de8019SJohn Baldwin.Nm devctl_disable , 3564de8019SJohn Baldwin.Nm devctl_enable , 365fa29797SWarner Losh.Nm devctl_freeze , 37b01f409fSWarner Losh.Nm devctl_getpath , 38a907c691SJohn Baldwin.Nm devctl_rescan , 394fbf8e1cSKonstantin Belousov.Nm devctl_reset , 4064de8019SJohn Baldwin.Nm devctl_resume , 410fd00e0cSJohn Baldwin.Nm devctl_set_driver , 425fa29797SWarner Losh.Nm devctl_suspend , 435fa29797SWarner Losh.Nm devctl_thaw 4464de8019SJohn Baldwin.Nd device control library 4564de8019SJohn Baldwin.Sh LIBRARY 4664de8019SJohn Baldwin.Lb libdevctl 4764de8019SJohn Baldwin.Sh SYNOPSIS 4864de8019SJohn Baldwin.In devctl.h 4964de8019SJohn Baldwin.Ft int 5064de8019SJohn Baldwin.Fn devctl_attach "const char *device" 5164de8019SJohn Baldwin.Ft int 52e05ec081SJohn Baldwin.Fn devctl_clear_driver "const char *device" "bool force" 53e05ec081SJohn Baldwin.Ft int 5488eb5c50SJohn Baldwin.Fn devctl_delete "const char *device" "bool force" 5588eb5c50SJohn Baldwin.Ft int 5664de8019SJohn Baldwin.Fn devctl_detach "const char *device" "bool force" 5764de8019SJohn Baldwin.Ft int 5864de8019SJohn Baldwin.Fn devctl_disable "const char *device" "bool force_detach" 5964de8019SJohn Baldwin.Ft int 6064de8019SJohn Baldwin.Fn devctl_enable "const char *device" 6164de8019SJohn Baldwin.Ft int 625fa29797SWarner Losh.Fn devctl_freeze "void" 635fa29797SWarner Losh.Ft int 64b01f409fSWarner Losh.Fn devctl_getpath "const char *device" "const char *locator" "char **buffer" 65b01f409fSWarner Losh.Ft int 66a907c691SJohn Baldwin.Fn devctl_rescan "const char *device" 67a907c691SJohn Baldwin.Ft int 684fbf8e1cSKonstantin Belousov.Fn devctl_reset "const char *device" "bool detach" 694fbf8e1cSKonstantin 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 203b01f409fSWarner Losh.Fn devctl_getpath 204b01f409fSWarner Loshretrieves the path to the 205b01f409fSWarner Losh.Fa device 206b01f409fSWarner Loshfrom the kernel using the 207b01f409fSWarner Losh.Fa locator 208b01f409fSWarner Loshmethod to construct the path. 209b01f409fSWarner LoshThe 210b01f409fSWarner Losh.Fa buffer 211b01f409fSWarner Loshpointer is updated with an allocated buffer that must be freed with 212*a51584a2SGraham Percival.Xr free 3 . 213b01f409fSWarner Losh.Pp 214b01f409fSWarner LoshThe 2155fa29797SWarner Losh.Fn devctl_freeze 2165fa29797SWarner Loshfunction freezes probe and attach processing initiated in response to 2175fa29797SWarner Loshdrivers being loaded. 2185fa29797SWarner Losh.Pp 2195fa29797SWarner LoshThe 2205fa29797SWarner Losh.Fn devctl_thaw 2215fa29797SWarner Loshfunction resumes (thaws the freeze) probe and attach processing 2225fa29797SWarner Loshinitiated in response to drivers being loaded. 2234fbf8e1cSKonstantin Belousov.Pp 2244fbf8e1cSKonstantin BelousovThe 2254fbf8e1cSKonstantin Belousov.Fn devctl_reset 2264fbf8e1cSKonstantin Belousovfunction resets the specified device using bus-specific reset method. 2274fbf8e1cSKonstantin BelousovThe 2284fbf8e1cSKonstantin Belousov.Fa detach 2294fbf8e1cSKonstantin Belousovargument, if true, specifies that the device driver is detached before 2304fbf8e1cSKonstantin Belousovthe reset, and re-attached afterwards. 2314fbf8e1cSKonstantin BelousovIf false, the device is suspended before the reset, and resumed after. 23264de8019SJohn Baldwin.Sh RETURN VALUES 233e05ec081SJohn Baldwin.Rv -std devctl_attach devctl_clear_driver devctl_delete devctl_detach \ 234e05ec081SJohn Baldwindevctl_disable devctl_enable devctl_suspend devctl_rescan devctl_resume \ 235e05ec081SJohn Baldwindevctl_set_driver 23664de8019SJohn Baldwin.Sh ERRORS 23764de8019SJohn BaldwinIn addition to specific errors noted below, 23864de8019SJohn Baldwinall of the 23964de8019SJohn Baldwin.Nm 24064de8019SJohn Baldwinfunctions may fail for any of the errors described in 24164de8019SJohn Baldwin.Xr open 2 24264de8019SJohn Baldwinas well as: 24364de8019SJohn Baldwin.Bl -tag -width Er 24464de8019SJohn Baldwin.It Bq Er EINVAL 24564de8019SJohn BaldwinThe device name is too long. 24664de8019SJohn Baldwin.It Bq Er ENOENT 24764de8019SJohn BaldwinNo existing device matches the specified name or location. 24864de8019SJohn Baldwin.It Bq Er EPERM 24964de8019SJohn BaldwinThe current process is not permitted to adjust the state of 25064de8019SJohn Baldwin.Fa device . 25164de8019SJohn Baldwin.El 25264de8019SJohn Baldwin.Pp 25364de8019SJohn BaldwinThe 25464de8019SJohn Baldwin.Fn devctl_attach 25564de8019SJohn Baldwinfunction may fail if: 25664de8019SJohn Baldwin.Bl -tag -width Er 25764de8019SJohn Baldwin.It Bq Er EBUSY 25864de8019SJohn BaldwinThe device is already attached. 25964de8019SJohn Baldwin.It Bq Er ENOMEM 26064de8019SJohn BaldwinAn internal memory allocation request failed. 26164de8019SJohn Baldwin.It Bq Er ENXIO 26264de8019SJohn BaldwinThe device is disabled. 26364de8019SJohn Baldwin.It Bq Er ENXIO 26464de8019SJohn BaldwinNo suitable driver for the device could be found, 26564de8019SJohn Baldwinor the driver failed to attach. 26664de8019SJohn Baldwin.El 26764de8019SJohn Baldwin.Pp 26864de8019SJohn BaldwinThe 26964de8019SJohn Baldwin.Fn devctl_detach 27064de8019SJohn Baldwinfunction may fail if: 27164de8019SJohn Baldwin.Bl -tag -width Er 27264de8019SJohn Baldwin.It Bq Er EBUSY 27364de8019SJohn BaldwinThe current device driver for 27464de8019SJohn Baldwin.Fa device 27564de8019SJohn Baldwinis busy and cannot detach at this time. 27664de8019SJohn BaldwinNote that some drivers may return this even if 27764de8019SJohn Baldwin.Fa force 27864de8019SJohn Baldwinis true. 27964de8019SJohn Baldwin.It Bq Er ENXIO 28064de8019SJohn BaldwinThe device is not attached to a driver. 28164de8019SJohn Baldwin.It Bq Er ENXIO 28264de8019SJohn BaldwinThe current device driver for 28364de8019SJohn Baldwin.Fa device 28464de8019SJohn Baldwindoes not support detaching. 28564de8019SJohn Baldwin.El 28664de8019SJohn Baldwin.Pp 28764de8019SJohn BaldwinThe 28864de8019SJohn Baldwin.Fn devctl_enable 28964de8019SJohn Baldwinfunction may fail if: 29064de8019SJohn Baldwin.Bl -tag -width Er 29164de8019SJohn Baldwin.It Bq Er EBUSY 29264de8019SJohn BaldwinThe device is already enabled. 29364de8019SJohn Baldwin.It Bq Er ENOMEM 29464de8019SJohn BaldwinAn internal memory allocation request failed. 29564de8019SJohn Baldwin.It Bq Er ENXIO 29664de8019SJohn BaldwinNo suitable driver for the device could be found, 29764de8019SJohn Baldwinor the driver failed to attach. 29864de8019SJohn Baldwin.El 29964de8019SJohn Baldwin.Pp 30064de8019SJohn BaldwinThe 30164de8019SJohn Baldwin.Fn devctl_disable 30264de8019SJohn Baldwinfunction may fail if: 30364de8019SJohn Baldwin.Bl -tag -width Er 30464de8019SJohn Baldwin.It Bq Er EBUSY 30564de8019SJohn BaldwinThe current device driver for 30664de8019SJohn Baldwin.Fa device 30764de8019SJohn Baldwinis busy and cannot detach at this time. 30864de8019SJohn BaldwinNote that some drivers may return this even if 30964de8019SJohn Baldwin.Fa force_detach 31064de8019SJohn Baldwinis true. 31164de8019SJohn Baldwin.It Bq Er ENXIO 31264de8019SJohn BaldwinThe device is already disabled. 31364de8019SJohn Baldwin.It Bq Er ENXIO 31464de8019SJohn BaldwinThe current device driver for 31564de8019SJohn Baldwin.Fa device 31664de8019SJohn Baldwindoes not support detaching. 31764de8019SJohn Baldwin.El 31864de8019SJohn Baldwin.Pp 31964de8019SJohn BaldwinThe 32064de8019SJohn Baldwin.Fn devctl_suspend 32164de8019SJohn Baldwinfunction may fail if: 32264de8019SJohn Baldwin.Bl -tag -width Er 32364de8019SJohn Baldwin.It Bq Er EBUSY 32464de8019SJohn BaldwinThe device is already suspended. 32564de8019SJohn Baldwin.It Bq Er EINVAL 32664de8019SJohn BaldwinThe device to be suspended is the root bus device. 32764de8019SJohn Baldwin.El 32864de8019SJohn Baldwin.Pp 32964de8019SJohn BaldwinThe 33064de8019SJohn Baldwin.Fn devctl_resume 33164de8019SJohn Baldwinfunction may fail if: 33264de8019SJohn Baldwin.Bl -tag -width Er 33364de8019SJohn Baldwin.It Bq Er EINVAL 33464de8019SJohn BaldwinThe device is not suspended. 33564de8019SJohn Baldwin.It Bq Er EINVAL 33664de8019SJohn BaldwinThe device to be resumed is the root bus device. 33764de8019SJohn Baldwin.El 33864de8019SJohn Baldwin.Pp 33964de8019SJohn BaldwinThe 34064de8019SJohn Baldwin.Fn devctl_set_driver 34164de8019SJohn Baldwinfunction may fail if: 34264de8019SJohn Baldwin.Bl -tag -width Er 34364de8019SJohn Baldwin.It Bq Er EBUSY 34464de8019SJohn BaldwinThe device is currently attached to a device driver and 34564de8019SJohn Baldwin.Fa force 34664de8019SJohn Baldwinis false. 34764de8019SJohn Baldwin.It Bq Er EBUSY 34864de8019SJohn BaldwinThe current device driver for 34964de8019SJohn Baldwin.Fa device 35064de8019SJohn Baldwinis busy and cannot detach at this time. 35164de8019SJohn Baldwin.It Bq Er EFAULT 35264de8019SJohn BaldwinThe 35364de8019SJohn Baldwin.Fa driver 35464de8019SJohn Baldwinargument points outside the process' allocated address space. 35564de8019SJohn Baldwin.It Bq Er ENOENT 35664de8019SJohn BaldwinNo device driver with the requested name exists. 35764de8019SJohn Baldwin.It Bq Er ENOMEM 35864de8019SJohn BaldwinAn internal memory allocation request failed. 35964de8019SJohn Baldwin.It Bq Er ENXIO 36064de8019SJohn BaldwinThe device is disabled. 36164de8019SJohn Baldwin.It Bq Er ENXIO 36264de8019SJohn BaldwinThe new device driver failed to attach. 36364de8019SJohn Baldwin.El 364a907c691SJohn Baldwin.Pp 365a907c691SJohn BaldwinThe 366e05ec081SJohn Baldwin.Fn devctl_clear_driver 367e05ec081SJohn Baldwinfunction may fail if: 368e05ec081SJohn Baldwin.Bl -tag -width Er 369e05ec081SJohn Baldwin.It Bq Er EBUSY 370e05ec081SJohn BaldwinThe device is currently attached to a device driver and 371e05ec081SJohn Baldwin.Fa force 372e05ec081SJohn Baldwinis false. 373e05ec081SJohn Baldwin.It Bq Er EBUSY 374e05ec081SJohn BaldwinThe current device driver for 375e05ec081SJohn Baldwin.Fa device 376e05ec081SJohn Baldwinis busy and cannot detach at this time. 377e05ec081SJohn Baldwin.It Bq Er EINVAL 378e05ec081SJohn BaldwinThe device is not configured for a specific device driver name. 379e05ec081SJohn Baldwin.It Bq Er ENXIO 380e05ec081SJohn BaldwinThe device driver chosen after reprobing failed to attach. 381e05ec081SJohn Baldwin.El 382e05ec081SJohn Baldwin.Pp 383e05ec081SJohn BaldwinThe 384a907c691SJohn Baldwin.Fn devctl_rescan 385a907c691SJohn Baldwinfunction may fail if: 386a907c691SJohn Baldwin.Bl -tag -width Er 387a907c691SJohn Baldwin.It Bq Er ENXIO 388a907c691SJohn BaldwinThe device is not attached to a driver. 389a907c691SJohn Baldwin.It Bq Er ENXIO 390a907c691SJohn BaldwinThe bus driver does not support rescanning. 391a907c691SJohn Baldwin.El 39288eb5c50SJohn Baldwin.Pp 39388eb5c50SJohn BaldwinThe 39488eb5c50SJohn Baldwin.Fn devctl_delete 39588eb5c50SJohn Baldwinfunction may fail if: 39688eb5c50SJohn Baldwin.Bl -tag -width Er 39788eb5c50SJohn Baldwin.It Bq Er EBUSY 39888eb5c50SJohn BaldwinThe device is physically present and 39988eb5c50SJohn Baldwin.Fa force 40088eb5c50SJohn Baldwinis false. 40188eb5c50SJohn Baldwin.It Bq Er EINVAL 40288eb5c50SJohn Baldwin.Fa dev 40388eb5c50SJohn Baldwinis the root device of the device tree. 40488eb5c50SJohn Baldwin.El 4054fbf8e1cSKonstantin Belousov.Pp 4064fbf8e1cSKonstantin BelousovThe 4074fbf8e1cSKonstantin Belousov.Fn devctl_reset 4084fbf8e1cSKonstantin Belousovfunction may fail if: 4094fbf8e1cSKonstantin Belousov.Bl -tag -width Er 4104fbf8e1cSKonstantin Belousov.It Bq Er ENXIO 4114fbf8e1cSKonstantin BelousovThe bus does not implement the reset method. 4124fbf8e1cSKonstantin Belousov.It Bq Er ETIMEDOUT 4134fbf8e1cSKonstantin BelousovThe device failed to respond after the reset in the time limits 4144fbf8e1cSKonstantin Belousovspecific to the bus. 4154fbf8e1cSKonstantin Belousov.El 4164fbf8e1cSKonstantin BelousovThe 4174fbf8e1cSKonstantin Belousov.Fn devctl_reset 4184fbf8e1cSKonstantin Belousovfunction may also return errors caused by the attach, detach, suspend, 4194fbf8e1cSKonstantin Belousovand resume methods of the device driver. 42064de8019SJohn Baldwin.Sh SEE ALSO 42164de8019SJohn Baldwin.Xr devinfo 3 , 42264de8019SJohn Baldwin.Xr devstat 3 , 42364de8019SJohn Baldwin.Xr devctl 8 42464de8019SJohn Baldwin.Sh HISTORY 42564de8019SJohn BaldwinThe 42664de8019SJohn Baldwin.Nm 42764de8019SJohn Baldwinlibrary first appeared in 4280fd00e0cSJohn Baldwin.Fx 10.3 . 42964de8019SJohn Baldwin.Sh BUGS 43064de8019SJohn BaldwinIf a device is suspended individually via 43164de8019SJohn Baldwin.Fn devctl_suspend 43264de8019SJohn Baldwinand the entire machine is subsequently suspended, 43364de8019SJohn Baldwinthe device will be resumed when the machine resumes. 4344fbf8e1cSKonstantin Belousov.Pp 4354fbf8e1cSKonstantin BelousovSimilarly, if the device is suspended, and 4364fbf8e1cSKonstantin Belousov.Fn devctl_reset 4374fbf8e1cSKonstantin Belousovis called on the device with 4384fbf8e1cSKonstantin Belousov.Fa detach 4394fbf8e1cSKonstantin Belousovset to 4404fbf8e1cSKonstantin Belousov.Va false , 4414fbf8e1cSKonstantin Belousovthe device is resumed by the 4424fbf8e1cSKonstantin Belousov.Fn devctl_reset 4434fbf8e1cSKonstantin Belousovcall. 4444fbf8e1cSKonstantin BelousovOr, if the driver for the device is detached manually, and 4454fbf8e1cSKonstantin Belousov.Fn devctl_reset 4464fbf8e1cSKonstantin Belousovis called on the device with 4474fbf8e1cSKonstantin Belousov.Fa detach 4484fbf8e1cSKonstantin Belousovset to 4494fbf8e1cSKonstantin Belousov.Va true , 4504fbf8e1cSKonstantin Belousovdevice reset re-attaches the driver. 451