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.\" 274fbf8e1cSKonstantin 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 , 39*b01f409fSWarner Losh.Nm devctl_getpath , 40a907c691SJohn Baldwin.Nm devctl_rescan , 414fbf8e1cSKonstantin 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 66*b01f409fSWarner Losh.Fn devctl_getpath "const char *device" "const char *locator" "char **buffer" 67*b01f409fSWarner Losh.Ft int 68a907c691SJohn Baldwin.Fn devctl_rescan "const char *device" 69a907c691SJohn Baldwin.Ft int 704fbf8e1cSKonstantin Belousov.Fn devctl_reset "const char *device" "bool detach" 714fbf8e1cSKonstantin Belousov.Ft int 7264de8019SJohn Baldwin.Fn devctl_resume "const char *device" 7364de8019SJohn Baldwin.Ft int 7464de8019SJohn Baldwin.Fn devctl_set_driver "const char *device" "const char *driver" "bool force" 750fd00e0cSJohn Baldwin.Ft int 760fd00e0cSJohn Baldwin.Fn devctl_suspend "const char *device" 775fa29797SWarner Losh.Ft int 785fa29797SWarner Losh.Fn devctl_thaw "void" 7964de8019SJohn Baldwin.Sh DESCRIPTION 8064de8019SJohn BaldwinThe 8164de8019SJohn Baldwin.Nm 8264de8019SJohn Baldwinlibrary adjusts the state of devices in the kernel's internal device 8364de8019SJohn Baldwinhierarchy. 8464de8019SJohn BaldwinEach control operation accepts a 8564de8019SJohn Baldwin.Fa device 8664de8019SJohn Baldwinargument that identifies the device to adjust. 8764de8019SJohn BaldwinThe 8864de8019SJohn Baldwin.Fa device 8964de8019SJohn Baldwinmay be specified as either the name of an existing device or as a 9064de8019SJohn Baldwinbus-specific address. 9164de8019SJohn BaldwinThe following bus-specific address formats are currently supported: 9264de8019SJohn Baldwin.Bl -tag -offset indent 9364de8019SJohn Baldwin.It Sy pci Ns Fa domain Ns : Ns Fa bus Ns : Ns Fa slot Ns : Ns Fa function 9464de8019SJohn BaldwinA PCI device with the specified 9564de8019SJohn Baldwin.Fa domain , 9664de8019SJohn Baldwin.Fa bus , 9764de8019SJohn Baldwin.Fa slot , 9864de8019SJohn Baldwinand 9964de8019SJohn Baldwin.Fa function . 10064de8019SJohn Baldwin.It Sy pci Ns Fa bus Ns : Ns Fa slot Ns : Ns Fa function 10164de8019SJohn BaldwinA PCI device in domain zero with the specified 10264de8019SJohn Baldwin.Fa bus , 10364de8019SJohn Baldwin.Fa slot , 10464de8019SJohn Baldwinand 10564de8019SJohn Baldwin.Fa function . 10664de8019SJohn Baldwin.It Fa handle 10764de8019SJohn BaldwinA device with an ACPI handle of 10864de8019SJohn Baldwin.Fa handle . 10964de8019SJohn BaldwinThe handle must be specified as an absolute path and must begin with a 11064de8019SJohn Baldwin.Dq \e . 11164de8019SJohn Baldwin.El 11264de8019SJohn Baldwin.Pp 11364de8019SJohn BaldwinThe 11464de8019SJohn Baldwin.Fn devctl_attach 11564de8019SJohn Baldwinfunction probes a device and attaches a suitable device driver if one is 11664de8019SJohn Baldwinfound. 11764de8019SJohn Baldwin.Pp 11864de8019SJohn BaldwinThe 11964de8019SJohn Baldwin.Fn devctl_detach 12064de8019SJohn Baldwinfunction detaches a device from its current device driver. 12164de8019SJohn BaldwinThe device is left detached until either a new driver for its parent 12264de8019SJohn Baldwinbus is loaded or the device is explicitly probed via 12364de8019SJohn Baldwin.Fn devctl_attach . 12464de8019SJohn BaldwinIf 12564de8019SJohn Baldwin.Fa force 12664de8019SJohn Baldwinis true, 12764de8019SJohn Baldwinthe current device driver will be detached even if the device is busy. 12864de8019SJohn Baldwin.Pp 12964de8019SJohn BaldwinThe 13088eb5c50SJohn Baldwin.Fn devctl_delete 13188eb5c50SJohn Baldwinfunction deletes a device from the device tree. 13288eb5c50SJohn BaldwinNo 13388eb5c50SJohn BaldwinIf 13488eb5c50SJohn Baldwin.Fa force 13588eb5c50SJohn Baldwinis true, 13688eb5c50SJohn Baldwinthe device is deleted even if the device is physically present. 13788eb5c50SJohn Baldwin.Pp 13888eb5c50SJohn BaldwinThe 13964de8019SJohn Baldwin.Fn devctl_disable 14064de8019SJohn Baldwinfunction disables a device. 14164de8019SJohn BaldwinIf the device is currently attached to a device driver, 14264de8019SJohn Baldwinthe device driver will be detached from the device, 14364de8019SJohn Baldwinbut the device will retain its current name. 14464de8019SJohn BaldwinIf 14564de8019SJohn Baldwin.Fa force_detach 14664de8019SJohn Baldwinis true, 14764de8019SJohn Baldwinthe current device driver will be detached even if the device is busy. 14864de8019SJohn BaldwinThe device will remain disabled and detached until it is explicitly enabled 14964de8019SJohn Baldwinvia 15064de8019SJohn Baldwin.Fn devctl_enable . 15164de8019SJohn Baldwin.Pp 15264de8019SJohn BaldwinThe 15364de8019SJohn Baldwin.Fn devctl_enable 15464de8019SJohn Baldwinfunction re-enables a disabled device. 15564de8019SJohn BaldwinThe device will probe and attach if a suitable device driver is found. 15664de8019SJohn Baldwin.Pp 15764de8019SJohn BaldwinThe 15864de8019SJohn Baldwin.Fn devctl_suspend 15964de8019SJohn Baldwinfunction suspends a device. 16064de8019SJohn BaldwinThis may include placing the device in a reduced power state, 16164de8019SJohn Baldwinbut any device driver currently attached to the device will remain attached. 16264de8019SJohn Baldwin.Pp 16364de8019SJohn BaldwinThe 16464de8019SJohn Baldwin.Fn devctl_resume 16564de8019SJohn Baldwinfunction resumes a suspended device to a fully working state. 16664de8019SJohn Baldwin.Pp 16764de8019SJohn BaldwinThe 16864de8019SJohn Baldwin.Fn devctl_set_driver 16964de8019SJohn Baldwinfunction attaches a device driver named 17064de8019SJohn Baldwin.Fa driver 17164de8019SJohn Baldwinto a device. 17264de8019SJohn BaldwinIf the device is already attached and 17364de8019SJohn Baldwin.Fa force 17464de8019SJohn Baldwinis false, 17564de8019SJohn Baldwinthe request will fail. 17664de8019SJohn BaldwinIf the device is already attached and 17764de8019SJohn Baldwin.Fa force 17864de8019SJohn Baldwinis true, 17964de8019SJohn Baldwinthe device will be detached from its current device driver before it is 18064de8019SJohn Baldwinattached to the new device driver. 181a907c691SJohn Baldwin.Pp 182a907c691SJohn BaldwinThe 183e05ec081SJohn Baldwin.Fn devctl_clear_driver 184e05ec081SJohn Baldwinfunction resets a device so that it can be attached to any valid device 185e05ec081SJohn Baldwindriver rather than only drivers with a previously specified name. 186e05ec081SJohn BaldwinThis function is used to undo a previous call to 187e05ec081SJohn Baldwin.Fn devctl_set_driver . 188e05ec081SJohn BaldwinIf the device is already attached and 189e05ec081SJohn Baldwin.Fa force 190e05ec081SJohn Baldwinis false, 191e05ec081SJohn Baldwinthe request will fail. 192e05ec081SJohn BaldwinIf the device is already attached and 193e05ec081SJohn Baldwin.Fa force 194e05ec081SJohn Baldwinis true, 195e05ec081SJohn Baldwinthe device will be detached from its current device driver. 196e05ec081SJohn BaldwinAfter the device's name is reset, 197e05ec081SJohn Baldwinit is reprobed and attached to a suitable device driver if one is found. 198e05ec081SJohn Baldwin.Pp 199e05ec081SJohn BaldwinThe 200a907c691SJohn Baldwin.Fn devctl_rescan 201a907c691SJohn Baldwinfunction rescans a bus device checking for devices that have been added or 202a907c691SJohn Baldwinremoved. 2035fa29797SWarner Losh.Pp 2045fa29797SWarner LoshThe 205*b01f409fSWarner Losh.Fn devctl_getpath 206*b01f409fSWarner Loshretrieves the path to the 207*b01f409fSWarner Losh.Fa device 208*b01f409fSWarner Loshfrom the kernel using the 209*b01f409fSWarner Losh.Fa locator 210*b01f409fSWarner Loshmethod to construct the path. 211*b01f409fSWarner LoshThe 212*b01f409fSWarner Losh.Fa buffer 213*b01f409fSWarner Loshpointer is updated with an allocated buffer that must be freed with 214*b01f409fSWarner Losh.Xr free . 215*b01f409fSWarner Losh.Pp 216*b01f409fSWarner LoshThe 2175fa29797SWarner Losh.Fn devctl_freeze 2185fa29797SWarner Loshfunction freezes probe and attach processing initiated in response to 2195fa29797SWarner Loshdrivers being loaded. 2205fa29797SWarner Losh.Pp 2215fa29797SWarner LoshThe 2225fa29797SWarner Losh.Fn devctl_thaw 2235fa29797SWarner Loshfunction resumes (thaws the freeze) probe and attach processing 2245fa29797SWarner Loshinitiated in response to drivers being loaded. 2254fbf8e1cSKonstantin Belousov.Pp 2264fbf8e1cSKonstantin BelousovThe 2274fbf8e1cSKonstantin Belousov.Fn devctl_reset 2284fbf8e1cSKonstantin Belousovfunction resets the specified device using bus-specific reset method. 2294fbf8e1cSKonstantin BelousovThe 2304fbf8e1cSKonstantin Belousov.Fa detach 2314fbf8e1cSKonstantin Belousovargument, if true, specifies that the device driver is detached before 2324fbf8e1cSKonstantin Belousovthe reset, and re-attached afterwards. 2334fbf8e1cSKonstantin BelousovIf false, the device is suspended before the reset, and resumed after. 23464de8019SJohn Baldwin.Sh RETURN VALUES 235e05ec081SJohn Baldwin.Rv -std devctl_attach devctl_clear_driver devctl_delete devctl_detach \ 236e05ec081SJohn Baldwindevctl_disable devctl_enable devctl_suspend devctl_rescan devctl_resume \ 237e05ec081SJohn Baldwindevctl_set_driver 23864de8019SJohn Baldwin.Sh ERRORS 23964de8019SJohn BaldwinIn addition to specific errors noted below, 24064de8019SJohn Baldwinall of the 24164de8019SJohn Baldwin.Nm 24264de8019SJohn Baldwinfunctions may fail for any of the errors described in 24364de8019SJohn Baldwin.Xr open 2 24464de8019SJohn Baldwinas well as: 24564de8019SJohn Baldwin.Bl -tag -width Er 24664de8019SJohn Baldwin.It Bq Er EINVAL 24764de8019SJohn BaldwinThe device name is too long. 24864de8019SJohn Baldwin.It Bq Er ENOENT 24964de8019SJohn BaldwinNo existing device matches the specified name or location. 25064de8019SJohn Baldwin.It Bq Er EPERM 25164de8019SJohn BaldwinThe current process is not permitted to adjust the state of 25264de8019SJohn Baldwin.Fa device . 25364de8019SJohn Baldwin.El 25464de8019SJohn Baldwin.Pp 25564de8019SJohn BaldwinThe 25664de8019SJohn Baldwin.Fn devctl_attach 25764de8019SJohn Baldwinfunction may fail if: 25864de8019SJohn Baldwin.Bl -tag -width Er 25964de8019SJohn Baldwin.It Bq Er EBUSY 26064de8019SJohn BaldwinThe device is already attached. 26164de8019SJohn Baldwin.It Bq Er ENOMEM 26264de8019SJohn BaldwinAn internal memory allocation request failed. 26364de8019SJohn Baldwin.It Bq Er ENXIO 26464de8019SJohn BaldwinThe device is disabled. 26564de8019SJohn Baldwin.It Bq Er ENXIO 26664de8019SJohn BaldwinNo suitable driver for the device could be found, 26764de8019SJohn Baldwinor the driver failed to attach. 26864de8019SJohn Baldwin.El 26964de8019SJohn Baldwin.Pp 27064de8019SJohn BaldwinThe 27164de8019SJohn Baldwin.Fn devctl_detach 27264de8019SJohn Baldwinfunction may fail if: 27364de8019SJohn Baldwin.Bl -tag -width Er 27464de8019SJohn Baldwin.It Bq Er EBUSY 27564de8019SJohn BaldwinThe current device driver for 27664de8019SJohn Baldwin.Fa device 27764de8019SJohn Baldwinis busy and cannot detach at this time. 27864de8019SJohn BaldwinNote that some drivers may return this even if 27964de8019SJohn Baldwin.Fa force 28064de8019SJohn Baldwinis true. 28164de8019SJohn Baldwin.It Bq Er ENXIO 28264de8019SJohn BaldwinThe device is not attached to a driver. 28364de8019SJohn Baldwin.It Bq Er ENXIO 28464de8019SJohn BaldwinThe current device driver for 28564de8019SJohn Baldwin.Fa device 28664de8019SJohn Baldwindoes not support detaching. 28764de8019SJohn Baldwin.El 28864de8019SJohn Baldwin.Pp 28964de8019SJohn BaldwinThe 29064de8019SJohn Baldwin.Fn devctl_enable 29164de8019SJohn Baldwinfunction may fail if: 29264de8019SJohn Baldwin.Bl -tag -width Er 29364de8019SJohn Baldwin.It Bq Er EBUSY 29464de8019SJohn BaldwinThe device is already enabled. 29564de8019SJohn Baldwin.It Bq Er ENOMEM 29664de8019SJohn BaldwinAn internal memory allocation request failed. 29764de8019SJohn Baldwin.It Bq Er ENXIO 29864de8019SJohn BaldwinNo suitable driver for the device could be found, 29964de8019SJohn Baldwinor the driver failed to attach. 30064de8019SJohn Baldwin.El 30164de8019SJohn Baldwin.Pp 30264de8019SJohn BaldwinThe 30364de8019SJohn Baldwin.Fn devctl_disable 30464de8019SJohn Baldwinfunction may fail if: 30564de8019SJohn Baldwin.Bl -tag -width Er 30664de8019SJohn Baldwin.It Bq Er EBUSY 30764de8019SJohn BaldwinThe current device driver for 30864de8019SJohn Baldwin.Fa device 30964de8019SJohn Baldwinis busy and cannot detach at this time. 31064de8019SJohn BaldwinNote that some drivers may return this even if 31164de8019SJohn Baldwin.Fa force_detach 31264de8019SJohn Baldwinis true. 31364de8019SJohn Baldwin.It Bq Er ENXIO 31464de8019SJohn BaldwinThe device is already disabled. 31564de8019SJohn Baldwin.It Bq Er ENXIO 31664de8019SJohn BaldwinThe current device driver for 31764de8019SJohn Baldwin.Fa device 31864de8019SJohn Baldwindoes not support detaching. 31964de8019SJohn Baldwin.El 32064de8019SJohn Baldwin.Pp 32164de8019SJohn BaldwinThe 32264de8019SJohn Baldwin.Fn devctl_suspend 32364de8019SJohn Baldwinfunction may fail if: 32464de8019SJohn Baldwin.Bl -tag -width Er 32564de8019SJohn Baldwin.It Bq Er EBUSY 32664de8019SJohn BaldwinThe device is already suspended. 32764de8019SJohn Baldwin.It Bq Er EINVAL 32864de8019SJohn BaldwinThe device to be suspended is the root bus device. 32964de8019SJohn Baldwin.El 33064de8019SJohn Baldwin.Pp 33164de8019SJohn BaldwinThe 33264de8019SJohn Baldwin.Fn devctl_resume 33364de8019SJohn Baldwinfunction may fail if: 33464de8019SJohn Baldwin.Bl -tag -width Er 33564de8019SJohn Baldwin.It Bq Er EINVAL 33664de8019SJohn BaldwinThe device is not suspended. 33764de8019SJohn Baldwin.It Bq Er EINVAL 33864de8019SJohn BaldwinThe device to be resumed is the root bus device. 33964de8019SJohn Baldwin.El 34064de8019SJohn Baldwin.Pp 34164de8019SJohn BaldwinThe 34264de8019SJohn Baldwin.Fn devctl_set_driver 34364de8019SJohn Baldwinfunction may fail if: 34464de8019SJohn Baldwin.Bl -tag -width Er 34564de8019SJohn Baldwin.It Bq Er EBUSY 34664de8019SJohn BaldwinThe device is currently attached to a device driver and 34764de8019SJohn Baldwin.Fa force 34864de8019SJohn Baldwinis false. 34964de8019SJohn Baldwin.It Bq Er EBUSY 35064de8019SJohn BaldwinThe current device driver for 35164de8019SJohn Baldwin.Fa device 35264de8019SJohn Baldwinis busy and cannot detach at this time. 35364de8019SJohn Baldwin.It Bq Er EFAULT 35464de8019SJohn BaldwinThe 35564de8019SJohn Baldwin.Fa driver 35664de8019SJohn Baldwinargument points outside the process' allocated address space. 35764de8019SJohn Baldwin.It Bq Er ENOENT 35864de8019SJohn BaldwinNo device driver with the requested name exists. 35964de8019SJohn Baldwin.It Bq Er ENOMEM 36064de8019SJohn BaldwinAn internal memory allocation request failed. 36164de8019SJohn Baldwin.It Bq Er ENXIO 36264de8019SJohn BaldwinThe device is disabled. 36364de8019SJohn Baldwin.It Bq Er ENXIO 36464de8019SJohn BaldwinThe new device driver failed to attach. 36564de8019SJohn Baldwin.El 366a907c691SJohn Baldwin.Pp 367a907c691SJohn BaldwinThe 368e05ec081SJohn Baldwin.Fn devctl_clear_driver 369e05ec081SJohn Baldwinfunction may fail if: 370e05ec081SJohn Baldwin.Bl -tag -width Er 371e05ec081SJohn Baldwin.It Bq Er EBUSY 372e05ec081SJohn BaldwinThe device is currently attached to a device driver and 373e05ec081SJohn Baldwin.Fa force 374e05ec081SJohn Baldwinis false. 375e05ec081SJohn Baldwin.It Bq Er EBUSY 376e05ec081SJohn BaldwinThe current device driver for 377e05ec081SJohn Baldwin.Fa device 378e05ec081SJohn Baldwinis busy and cannot detach at this time. 379e05ec081SJohn Baldwin.It Bq Er EINVAL 380e05ec081SJohn BaldwinThe device is not configured for a specific device driver name. 381e05ec081SJohn Baldwin.It Bq Er ENXIO 382e05ec081SJohn BaldwinThe device driver chosen after reprobing failed to attach. 383e05ec081SJohn Baldwin.El 384e05ec081SJohn Baldwin.Pp 385e05ec081SJohn BaldwinThe 386a907c691SJohn Baldwin.Fn devctl_rescan 387a907c691SJohn Baldwinfunction may fail if: 388a907c691SJohn Baldwin.Bl -tag -width Er 389a907c691SJohn Baldwin.It Bq Er ENXIO 390a907c691SJohn BaldwinThe device is not attached to a driver. 391a907c691SJohn Baldwin.It Bq Er ENXIO 392a907c691SJohn BaldwinThe bus driver does not support rescanning. 393a907c691SJohn Baldwin.El 39488eb5c50SJohn Baldwin.Pp 39588eb5c50SJohn BaldwinThe 39688eb5c50SJohn Baldwin.Fn devctl_delete 39788eb5c50SJohn Baldwinfunction may fail if: 39888eb5c50SJohn Baldwin.Bl -tag -width Er 39988eb5c50SJohn Baldwin.It Bq Er EBUSY 40088eb5c50SJohn BaldwinThe device is physically present and 40188eb5c50SJohn Baldwin.Fa force 40288eb5c50SJohn Baldwinis false. 40388eb5c50SJohn Baldwin.It Bq Er EINVAL 40488eb5c50SJohn Baldwin.Fa dev 40588eb5c50SJohn Baldwinis the root device of the device tree. 40688eb5c50SJohn Baldwin.El 4074fbf8e1cSKonstantin Belousov.Pp 4084fbf8e1cSKonstantin BelousovThe 4094fbf8e1cSKonstantin Belousov.Fn devctl_reset 4104fbf8e1cSKonstantin Belousovfunction may fail if: 4114fbf8e1cSKonstantin Belousov.Bl -tag -width Er 4124fbf8e1cSKonstantin Belousov.It Bq Er ENXIO 4134fbf8e1cSKonstantin BelousovThe bus does not implement the reset method. 4144fbf8e1cSKonstantin Belousov.It Bq Er ETIMEDOUT 4154fbf8e1cSKonstantin BelousovThe device failed to respond after the reset in the time limits 4164fbf8e1cSKonstantin Belousovspecific to the bus. 4174fbf8e1cSKonstantin Belousov.El 4184fbf8e1cSKonstantin BelousovThe 4194fbf8e1cSKonstantin Belousov.Fn devctl_reset 4204fbf8e1cSKonstantin Belousovfunction may also return errors caused by the attach, detach, suspend, 4214fbf8e1cSKonstantin Belousovand resume methods of the device driver. 42264de8019SJohn Baldwin.Sh SEE ALSO 42364de8019SJohn Baldwin.Xr devinfo 3 , 42464de8019SJohn Baldwin.Xr devstat 3 , 42564de8019SJohn Baldwin.Xr devctl 8 42664de8019SJohn Baldwin.Sh HISTORY 42764de8019SJohn BaldwinThe 42864de8019SJohn Baldwin.Nm 42964de8019SJohn Baldwinlibrary first appeared in 4300fd00e0cSJohn Baldwin.Fx 10.3 . 43164de8019SJohn Baldwin.Sh BUGS 43264de8019SJohn BaldwinIf a device is suspended individually via 43364de8019SJohn Baldwin.Fn devctl_suspend 43464de8019SJohn Baldwinand the entire machine is subsequently suspended, 43564de8019SJohn Baldwinthe device will be resumed when the machine resumes. 4364fbf8e1cSKonstantin Belousov.Pp 4374fbf8e1cSKonstantin BelousovSimilarly, if the device is suspended, and 4384fbf8e1cSKonstantin Belousov.Fn devctl_reset 4394fbf8e1cSKonstantin Belousovis called on the device with 4404fbf8e1cSKonstantin Belousov.Fa detach 4414fbf8e1cSKonstantin Belousovset to 4424fbf8e1cSKonstantin Belousov.Va false , 4434fbf8e1cSKonstantin Belousovthe device is resumed by the 4444fbf8e1cSKonstantin Belousov.Fn devctl_reset 4454fbf8e1cSKonstantin Belousovcall. 4464fbf8e1cSKonstantin BelousovOr, if the driver for the device is detached manually, and 4474fbf8e1cSKonstantin Belousov.Fn devctl_reset 4484fbf8e1cSKonstantin Belousovis called on the device with 4494fbf8e1cSKonstantin Belousov.Fa detach 4504fbf8e1cSKonstantin Belousovset to 4514fbf8e1cSKonstantin Belousov.Va true , 4524fbf8e1cSKonstantin Belousovdevice reset re-attaches the driver. 453