acpi_pcidev_scan: attach PCI information only to working devices.

ok jruoho@
This commit is contained in:
gsutre 2010-08-09 09:36:42 +00:00
parent 021de39995
commit 474664a934
2 changed files with 16 additions and 4 deletions

View File

@ -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 @@ acpi_rescan_nodes(struct acpi_softc *sc)
* 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) {

View File

@ -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 @@ acpi_pcidev_scan(struct acpi_devnode *ad)
!(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);