Module Name: src Committed By: gsutre Date: Mon Aug 9 09:36:42 UTC 2010
Modified Files: src/sys/dev/acpi: acpi.c acpi_pci.c Log Message: acpi_pcidev_scan: attach PCI information only to working devices. ok jruoho@ To generate a diff of this commit: cvs rdiff -u -r1.214 -r1.215 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/acpi/acpi_pci.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.214 src/sys/dev/acpi/acpi.c:1.215 --- src/sys/dev/acpi/acpi.c:1.214 Sat Aug 7 20:07:25 2010 +++ src/sys/dev/acpi/acpi.c Mon Aug 9 09:36:42 2010 @@ -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) { Index: src/sys/dev/acpi/acpi_pci.c diff -u src/sys/dev/acpi/acpi_pci.c:1.13 src/sys/dev/acpi/acpi_pci.c:1.14 --- src/sys/dev/acpi/acpi_pci.c:1.13 Sun Aug 8 16:26:47 2010 +++ src/sys/dev/acpi/acpi_pci.c Mon Aug 9 09:36:42 2010 @@ -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);