Mon Aug 9 09:36:42 2010 UTC ()
acpi_pcidev_scan: attach PCI information only to working devices.

ok jruoho@


(gsutre)
diff -r1.214 -r1.215 src/sys/dev/acpi/acpi.c
diff -r1.13 -r1.14 src/sys/dev/acpi/acpi_pci.c

cvs diff -r1.214 -r1.215 src/sys/dev/acpi/acpi.c (expand / switch to context diff)
--- src/sys/dev/acpi/acpi.c 2010/08/07 20:07:25 1.214
+++ src/sys/dev/acpi/acpi.c 2010/08/09 09:36:42 1.215
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi.c,v 1.214 2010/08/07 20:07:25 jruoho Exp $	*/
+/*	$NetBSD: acpi.c,v 1.215 2010/08/09 09:36:42 gsutre 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.214 2010/08/07 20:07:25 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.215 2010/08/09 09:36:42 gsutre Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -963,6 +963,8 @@
 		 * functioning properly. However, if a device is enabled,
 		 * it is decoding resources and we should claim these,
 		 * if possible. This requires changes to bus_space(9).
+		 * Note: there is a possible race condition, because _STA
+		 * may have changed since di->CurrentStatus was set.
 		 */
 		if (di->Type == ACPI_TYPE_DEVICE) {
 

cvs diff -r1.13 -r1.14 src/sys/dev/acpi/acpi_pci.c (expand / switch to context diff)
--- src/sys/dev/acpi/acpi_pci.c 2010/08/08 16:26:47 1.13
+++ src/sys/dev/acpi/acpi_pci.c 2010/08/09 09:36:42 1.14
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.13 2010/08/08 16:26:47 gsutre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.14 2010/08/09 09:36:42 gsutre Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -167,6 +167,16 @@
 
 	if (ad->ad_devinfo->Type != ACPI_TYPE_DEVICE ||
 	    !(ad->ad_devinfo->Valid & ACPI_VALID_ADR))
+		goto rec;
+
+	/*
+	 * We attach PCI information only to devices that are present,
+	 * enabled, and functioning properly.
+	 * Note: there is a possible race condition, because _STA may
+	 * have changed since ad->ad_devinfo->CurrentStatus was set.
+	 */
+	if ((ad->ad_devinfo->Valid & ACPI_VALID_STA) != 0 &&
+	    (ad->ad_devinfo->CurrentStatus & ACPI_STA_OK) != ACPI_STA_OK)
 		goto rec;
 
 	if (ad->ad_devinfo->Flags & ACPI_PCI_ROOT_BRIDGE) {