Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpi_pcidev_scan: attach PCI information only t...



details:   https://anonhg.NetBSD.org/src/rev/c1ef09d1cd94
branches:  trunk
changeset: 756980:c1ef09d1cd94
user:      gsutre <gsutre%NetBSD.org@localhost>
date:      Mon Aug 09 09:36:42 2010 +0000

description:
acpi_pcidev_scan: attach PCI information only to working devices.

ok jruoho@

diffstat:

 sys/dev/acpi/acpi.c     |   6 ++++--
 sys/dev/acpi/acpi_pci.c |  14 ++++++++++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r 9fc4bea9a0fc -r c1ef09d1cd94 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon Aug 09 06:40:33 2010 +0000
+++ b/sys/dev/acpi/acpi.c       Mon Aug 09 09:36:42 2010 +0000
@@ -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) {
 
diff -r 9fc4bea9a0fc -r c1ef09d1cd94 sys/dev/acpi/acpi_pci.c
--- a/sys/dev/acpi/acpi_pci.c   Mon Aug 09 06:40:33 2010 +0000
+++ b/sys/dev/acpi/acpi_pci.c   Mon Aug 09 09:36:42 2010 +0000
@@ -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>
@@ -169,6 +169,16 @@
            !(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) {
 
                ap = kmem_zalloc(sizeof(*ap), KM_SLEEP);



Home | Main Index | Thread Index | Old Index