Module Name: src Committed By: jruoho Date: Mon Jan 3 08:50:23 UTC 2011
Modified Files: src/sys/dev/acpi: acpi.c acpi_verbose.c Log Message: Scan for devices that are "hot-pluggable". To generate a diff of this commit: cvs rdiff -u -r1.224 -r1.225 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.15 -r1.16 src/sys/dev/acpi/acpi_verbose.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi.c diff -u src/sys/dev/acpi/acpi.c:1.224 src/sys/dev/acpi/acpi.c:1.225 --- src/sys/dev/acpi/acpi.c:1.224 Sun Jan 2 06:05:47 2011 +++ src/sys/dev/acpi/acpi.c Mon Jan 3 08:50:23 2011 @@ -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; } } Index: src/sys/dev/acpi/acpi_verbose.c diff -u src/sys/dev/acpi/acpi_verbose.c:1.15 src/sys/dev/acpi/acpi_verbose.c:1.16 --- src/sys/dev/acpi/acpi_verbose.c:1.15 Fri Dec 31 14:05:15 2010 +++ src/sys/dev/acpi/acpi_verbose.c Mon Jan 3 08:50:23 2011 @@ -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));