Wed May 12 16:11:05 2010 UTC ()
When scanning the device "capabilities" (power, wake-up, etc.),
include all device nodes, regardless of the status of the device.

XXX: It is known that some systems implement the _STA method incorrectly.
     If needed in the future, attachment based on the values from this
     method may need revisiting. Same goes for ACPI_ACTIVATE_DEV.


(jruoho)
diff -r1.194 -r1.195 src/sys/dev/acpi/acpi.c

cvs diff -r1.194 -r1.195 src/sys/dev/acpi/acpi.c (expand / switch to unified diff)

--- src/sys/dev/acpi/acpi.c 2010/04/27 08:36:06 1.194
+++ src/sys/dev/acpi/acpi.c 2010/05/12 16:11:05 1.195
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: acpi.c,v 1.194 2010/04/27 08:36:06 jruoho Exp $ */ 1/* $NetBSD: acpi.c,v 1.195 2010/05/12 16:11:05 jruoho Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc. 4 * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to The NetBSD Foundation 7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Charles M. Hannum of By Noon Software, Inc. 8 * by Charles M. Hannum of By Noon Software, Inc.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -55,27 +55,27 @@ @@ -55,27 +55,27 @@
55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 55 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 56 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC 57 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC
58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 58 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 59 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 60 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 61 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 62 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 63 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
64 * POSSIBILITY OF SUCH DAMAGE. 64 * POSSIBILITY OF SUCH DAMAGE.
65 */ 65 */
66 66
67#include <sys/cdefs.h> 67#include <sys/cdefs.h>
68__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.194 2010/04/27 08:36:06 jruoho Exp $"); 68__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.195 2010/05/12 16:11:05 jruoho Exp $");
69 69
70#include "opt_acpi.h" 70#include "opt_acpi.h"
71#include "opt_pcifixup.h" 71#include "opt_pcifixup.h"
72 72
73#include <sys/param.h> 73#include <sys/param.h>
74#include <sys/device.h> 74#include <sys/device.h>
75#include <sys/kernel.h> 75#include <sys/kernel.h>
76#include <sys/malloc.h> 76#include <sys/malloc.h>
77#include <sys/mutex.h> 77#include <sys/mutex.h>
78#include <sys/sysctl.h> 78#include <sys/sysctl.h>
79#include <sys/systm.h> 79#include <sys/systm.h>
80 80
81#include <dev/acpi/acpireg.h> 81#include <dev/acpi/acpireg.h>
@@ -974,39 +974,32 @@ acpi_rescan_nodes(struct acpi_softc *sc) @@ -974,39 +974,32 @@ acpi_rescan_nodes(struct acpi_softc *sc)
974 aa.aa_pc = sc->sc_pc; 974 aa.aa_pc = sc->sc_pc;
975 aa.aa_pciflags = sc->sc_pciflags; 975 aa.aa_pciflags = sc->sc_pciflags;
976 aa.aa_ic = sc->sc_ic; 976 aa.aa_ic = sc->sc_ic;
977 977
978 ad->ad_device = config_found_ia(sc->sc_dev, 978 ad->ad_device = config_found_ia(sc->sc_dev,
979 "acpinodebus", &aa, acpi_print); 979 "acpinodebus", &aa, acpi_print);
980 } 980 }
981} 981}
982 982
983static void 983static void
984acpi_rescan_capabilities(struct acpi_softc *sc) 984acpi_rescan_capabilities(struct acpi_softc *sc)
985{ 985{
986 struct acpi_devnode *ad; 986 struct acpi_devnode *ad;
987 ACPI_DEVICE_INFO *di; 
988 ACPI_HANDLE tmp; 987 ACPI_HANDLE tmp;
989 ACPI_STATUS rv; 988 ACPI_STATUS rv;
990 989
991 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) { 990 SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
992 991
993 di = ad->ad_devinfo; 992 if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE)
994 
995 if (di->Type != ACPI_TYPE_DEVICE) 
996 continue; 
997 
998 if ((di->Valid & ACPI_VALID_STA) != 0 && 
999 (di->CurrentStatus & ACPI_STA_OK) != ACPI_STA_OK) 
1000 continue; 993 continue;
1001 994
1002 /* 995 /*
1003 * Scan power resource capabilities. 996 * Scan power resource capabilities.
1004 * 997 *
1005 * If any power states are supported, 998 * If any power states are supported,
1006 * at least _PR0 and _PR3 must be present. 999 * at least _PR0 and _PR3 must be present.
1007 */ 1000 */
1008 rv = AcpiGetHandle(ad->ad_handle, "_PR0", &tmp); 1001 rv = AcpiGetHandle(ad->ad_handle, "_PR0", &tmp);
1009 1002
1010 if (ACPI_SUCCESS(rv)) { 1003 if (ACPI_SUCCESS(rv)) {
1011 ad->ad_flags |= ACPI_DEVICE_POWER; 1004 ad->ad_flags |= ACPI_DEVICE_POWER;
1012 acpi_power_add(ad); 1005 acpi_power_add(ad);