Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Scan for devices that are "hot-pluggable".



details:   https://anonhg.NetBSD.org/src/rev/abec984fd560
branches:  trunk
changeset: 760346:abec984fd560
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Jan 03 08:50:23 2011 +0000

description:
Scan for devices that are "hot-pluggable".

diffstat:

 sys/dev/acpi/acpi.c         |  12 ++++++++++--
 sys/dev/acpi/acpi_verbose.c |  20 +++++++++++++++-----
 2 files changed, 25 insertions(+), 7 deletions(-)

diffs (79 lines):

diff -r 72cfda9058b3 -r abec984fd560 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon Jan 03 06:15:16 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Mon Jan 03 08:50:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.224 2011/01/02 06:05:47 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.225 2011/01/03 08:50:23 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.224 2011/01/02 06:05:47 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.225 2011/01/03 08:50:23 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -1045,6 +1045,14 @@
                        ad->ad_flags |= ACPI_DEVICE_WAKEUP;
                        acpi_wakedev_add(ad);
                }
+
+               /*
+                * Scan devices that are ejectable.
+                */
+               rv = AcpiGetHandle(ad->ad_handle, "_EJ0", &tmp);
+
+               if (ACPI_SUCCESS(rv))
+                       ad->ad_flags |= ACPI_DEVICE_EJECT;
        }
 }
 
diff -r 72cfda9058b3 -r abec984fd560 sys/dev/acpi/acpi_verbose.c
--- a/sys/dev/acpi/acpi_verbose.c       Mon Jan 03 06:15:16 2011 +0000
+++ b/sys/dev/acpi/acpi_verbose.c       Mon Jan 03 08:50:23 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_verbose.c,v 1.15 2010/12/31 14:05:15 jruoho Exp $ */
+/*     $NetBSD: acpi_verbose.c,v 1.16 2011/01/03 08:50:23 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2010 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.15 2010/12/31 14:05:15 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_verbose.c,v 1.16 2011/01/03 08:50:23 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -460,14 +460,24 @@
 {
        struct acpi_devnode *child;
        device_t dev;
+       char buf[5];
        uint32_t i;
 
        for (i = 0; i < level; i++)
                aprint_normal("    ");
 
-       aprint_normal("%-5s [%02u] [%c%c]", ad->ad_name, ad->ad_type,
-           ((ad->ad_flags & ACPI_DEVICE_POWER)  != 0) ? 'P' : ' ',
-           ((ad->ad_flags & ACPI_DEVICE_WAKEUP) != 0) ? 'W' : ' ');
+       buf[0] = '\0';
+
+       if ((ad->ad_flags & ACPI_DEVICE_POWER) != 0)
+               (void)strlcat(buf, "P", sizeof(buf));
+
+       if ((ad->ad_flags & ACPI_DEVICE_WAKEUP) != 0)
+               (void)strlcat(buf, "W", sizeof(buf));
+
+       if ((ad->ad_flags & ACPI_DEVICE_EJECT) != 0)
+               (void)strlcat(buf, "E", sizeof(buf));
+
+       aprint_normal("%-5s [%02u] [%s]", ad->ad_name, ad->ad_type, buf);
 
        if (ad->ad_device != NULL)
                aprint_normal(" <%s>", device_xname(ad->ad_device));



Home | Main Index | Thread Index | Old Index