Author: kib
Date: Fri Apr 19 12:50:25 2019
New Revision: 346379
URL: https://svnweb.freebsd.org/changeset/base/346379

Log:
  MFC r345965:
  Add DEV_RESET /dev/devctl2 ioctl.

Modified:
  stable/12/sys/kern/subr_bus.c
  stable/12/sys/sys/bus.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/kern/subr_bus.c
==============================================================================
--- stable/12/sys/kern/subr_bus.c       Fri Apr 19 12:48:17 2019        
(r346378)
+++ stable/12/sys/kern/subr_bus.c       Fri Apr 19 12:50:25 2019        
(r346379)
@@ -5636,6 +5636,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t d
        case DEV_CLEAR_DRIVER:
        case DEV_RESCAN:
        case DEV_DELETE:
+       case DEV_RESET:
                error = priv_check(td, PRIV_DRIVER);
                if (error == 0)
                        error = find_device(req, &dev);
@@ -5860,6 +5861,14 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t d
                        device_do_deferred_actions();
                        device_frozen = false;
                }
+               break;
+       case DEV_RESET:
+               if ((req->dr_flags & ~(DEVF_RESET_DETACH)) != 0) {
+                       error = EINVAL;
+                       break;
+               }
+               error = BUS_RESET_CHILD(device_get_parent(dev), dev,
+                   req->dr_flags);
                break;
        }
        mtx_unlock(&Giant);

Modified: stable/12/sys/sys/bus.h
==============================================================================
--- stable/12/sys/sys/bus.h     Fri Apr 19 12:48:17 2019        (r346378)
+++ stable/12/sys/sys/bus.h     Fri Apr 19 12:50:25 2019        (r346379)
@@ -130,6 +130,7 @@ struct devreq {
 #define        DEV_DELETE      _IOW('D', 10, struct devreq)
 #define        DEV_FREEZE      _IOW('D', 11, struct devreq)
 #define        DEV_THAW        _IOW('D', 12, struct devreq)
+#define        DEV_RESET       _IOW('D', 13, struct devreq)
 
 /* Flags for DEV_DETACH and DEV_DISABLE. */
 #define        DEVF_FORCE_DETACH       0x0000001


_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to