Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-7]: src/sys Pull up following revision(s) (requested by bouyer in...



details:   https://anonhg.NetBSD.org/src/rev/116b0ca8cce1
branches:  netbsd-7
changeset: 799930:116b0ca8cce1
user:      snj <snj%NetBSD.org@localhost>
date:      Tue Jul 05 19:09:17 2016 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #1186):
        sys/dev/ata/wd.c: revision 1.421
        sys/kern/subr_autoconf.c: revision 1.242 via patch
        sys/sys/device.h: revision 1.149
Add a new config_detach() flag, DETACH_POWEROFF, which is set when
detaching devices at shutdown time with RB_POWERDOWN.
When detaching wd(4), put the drive in standby before detach
for DETACH_POWEROFF.
Fix PR kern/51252

diffstat:

 sys/dev/ata/wd.c         |   6 ++++--
 sys/kern/subr_autoconf.c |  12 +++++++++---
 sys/sys/device.h         |   3 ++-
 3 files changed, 15 insertions(+), 6 deletions(-)

diffs (84 lines):

diff -r 648dd414a1dc -r 116b0ca8cce1 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Tue Jul 05 19:06:48 2016 +0000
+++ b/sys/dev/ata/wd.c  Tue Jul 05 19:09:17 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.412.2.1 2014/11/11 10:36:41 martin Exp $ */
+/*     $NetBSD: wd.c,v 1.412.2.2 2016/07/05 19:09:17 snj Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.412.2.1 2014/11/11 10:36:41 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.412.2.2 2016/07/05 19:09:17 snj Exp $");
 
 #include "opt_ata.h"
 
@@ -464,6 +464,8 @@
 
        bufq_free(sc->sc_q);
        sc->atabus->ata_killpending(sc->drvp);
+       if (flags & DETACH_POWEROFF)
+               wd_standby(sc, AT_POLL);
 
        splx(s);
 
diff -r 648dd414a1dc -r 116b0ca8cce1 sys/kern/subr_autoconf.c
--- a/sys/kern/subr_autoconf.c  Tue Jul 05 19:06:48 2016 +0000
+++ b/sys/kern/subr_autoconf.c  Tue Jul 05 19:09:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: subr_autoconf.c,v 1.231.2.2 2015/11/16 14:40:41 msaitoh Exp $ */
+/* $NetBSD: subr_autoconf.c,v 1.231.2.3 2016/07/05 19:09:17 snj Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.231.2.2 2015/11/16 14:40:41 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.231.2.3 2016/07/05 19:09:17 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -1864,14 +1864,20 @@
        static struct shutdown_state s;
        device_t curdev;
        bool progress = false;
+       int flags;
 
        if ((how & RB_NOSYNC) != 0)
                return false;
 
+       if ((how & RB_POWERDOWN) == RB_POWERDOWN)
+               flags = DETACH_SHUTDOWN | DETACH_POWEROFF;
+       else
+               flags = DETACH_SHUTDOWN;
+
        for (curdev = shutdown_first(&s); curdev != NULL;
             curdev = shutdown_next(&s)) {
                aprint_debug(" detaching %s, ", device_xname(curdev));
-               if (config_detach(curdev, DETACH_SHUTDOWN) == 0) {
+               if (config_detach(curdev, flags) == 0) {
                        progress = true;
                        aprint_debug("success.");
                } else
diff -r 648dd414a1dc -r 116b0ca8cce1 sys/sys/device.h
--- a/sys/sys/device.h  Tue Jul 05 19:06:48 2016 +0000
+++ b/sys/sys/device.h  Tue Jul 05 19:09:17 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: device.h,v 1.144.4.1 2015/03/09 08:56:02 snj Exp $ */
+/* $NetBSD: device.h,v 1.144.4.2 2016/07/05 19:09:17 snj Exp $ */
 
 /*
  * Copyright (c) 1996, 2000 Christopher G. Demetriou
@@ -347,6 +347,7 @@
 #define        DETACH_FORCE    0x01            /* force detachment; hardware gone */
 #define        DETACH_QUIET    0x02            /* don't print a notice */
 #define        DETACH_SHUTDOWN 0x04            /* detach because of system shutdown */
+#define        DETACH_POWEROFF 0x08            /* going to power off; power down devices */
 
 struct cfdriver {
        LIST_ENTRY(cfdriver) cd_list;   /* link on allcfdrivers */



Home | Main Index | Thread Index | Old Index