Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 06 Feb 2015 11:58:19 -0500
From:      John Baldwin <jhb@freebsd.org>
To:        src-committers@freebsd.org
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org
Subject:   Re: svn commit: r278320 - in head: contrib/mdocml lib lib/libdevctl share/mk sys/dev/acpica sys/dev/pci sys/kern sys/sys usr.sbin usr.sbin/devctl
Message-ID:  <61974401.Fd0kRqNeQd@ralph.baldwin.cx>
In-Reply-To: <201502061609.t16G92rn091851@svn.freebsd.org>
References:  <201502061609.t16G92rn091851@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Friday, February 06, 2015 04:09:02 PM John Baldwin wrote:
> Author: jhb
> Date: Fri Feb  6 16:09:01 2015
> New Revision: 278320
> URL: https://svnweb.freebsd.org/changeset/base/278320
> 
> Log:
>   Add a new device control utility for new-bus devices called devctl.  This
>   allows the user to request administrative changes to individual devices
>   such as attach or detaching drivers or disabling and re-enabling devices.

For now I would consider this somewhat experimental.  Some bus drivers may not
take kindly to device_detach/device_probe_and_attach being called (Hans 
mentioned USB as a likely candidate).

Also, in theory you can use 'devctl suspend' to power off PCI devices you 
don't need, but most drivers probably don't expect to have to deal with user 
requests while suspended (e.g. I tested this by suspending hdac0 on a laptop, 
but I didn't try playing a sound to see if that blew up.. it would not 
surprise me if it did).

There are also some other rough edges such as: 

  1) An administratively suspended device will resume if you do a system-wide
     suspend and resume.

  2) There is no nice way for a driver to reject an administrative suspend
     request.  It could fail its device_suspend method perhaps, but the driver
     can't easily tell if a suspend request is administrative or due to a
     system suspend.  Perhaps we could re-use device_quiesce for this?

Some other commands that might be nice to add would be "reset" (to do a bus-
level reset of a device like PCI-e FLR), "rescan" (rescan the devices on a bus 
where that makes sense, e.g. on an individual PCI bus), and possibly "delete" 
(e.g. you could delete a PCI device and rescan the parent PCI bus to force PCI 
to re-probe from scratch.. useful if you are reprogramming an FPGA and need to 
change the BAR sizes, etc.)

-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?61974401.Fd0kRqNeQd>