Add DEV_RESET /dev/devctl2 ioctl.
It performs BUS_RESET_CHILD() on the parental bus and the specified device. Reviewed by: imp (previous version), jhb (previous version) Sponsored by: Mellanox Technologies MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D19646
This commit is contained in:
parent
7f755050f7
commit
1d1a5c2b02
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345965
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user