Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 03 Sep 2019 14:06:24 -0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r345965 - in head/sys: kern sys
Message-ID:  <201904051931.x35JVR3X087017@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Fri Apr  5 19:31:26 2019
New Revision: 345965
URL: https://svnweb.freebsd.org/changeset/base/345965

Log:
  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

Modified:
  head/sys/kern/subr_bus.c
  head/sys/sys/bus.h

Modified: head/sys/kern/subr_bus.c
==============================================================================
--- head/sys/kern/subr_bus.c	Fri Apr  5 19:27:51 2019	(r345964)
+++ head/sys/kern/subr_bus.c	Fri Apr  5 19:31:26 2019	(r345965)
@@ -5646,6 +5646,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);
@@ -5870,6 +5871,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: head/sys/sys/bus.h
==============================================================================
--- head/sys/sys/bus.h	Fri Apr  5 19:27:51 2019	(r345964)
+++ head/sys/sys/bus.h	Fri Apr  5 19:31:26 2019	(r345965)
@@ -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





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