Scan for devices that are "hot-pluggable".

This commit is contained in:
jruoho 2011-01-03 08:50:23 +00:00
parent ee16ecf67d
commit 6a3b9e2cde
2 changed files with 25 additions and 7 deletions

View File

@ -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 @@ acpi_rescan_capabilities(device_t self)
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;
}
}

View File

@ -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 @@ acpi_print_tree(struct acpi_devnode *ad, uint32_t level)
{
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));