diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c index 6c82f6de0644..b43a4f18180b 100644 --- a/sys/kern/subr_bus.c +++ b/sys/kern/subr_bus.c @@ -5646,6 +5646,7 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, 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); @@ -5871,6 +5872,14 @@ devctl2_ioctl(struct cdev *cdev, u_long cmd, caddr_t data, int fflag, 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); return (error); diff --git a/sys/sys/bus.h b/sys/sys/bus.h index a9fc2387eccf..9c2b92af2983 100644 --- a/sys/sys/bus.h +++ b/sys/sys/bus.h @@ -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