Module Name: src Committed By: matt Date: Wed Mar 2 21:57:40 UTC 2011
Modified Files: src/sys/dev/pci: pci.c Log Message: When probing the PCI bars, make sure to only probe BARS (PPBs and PCB has fewer bars than type 0 devices). To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/sys/dev/pci/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/pci/pci.c diff -u src/sys/dev/pci/pci.c:1.134 src/sys/dev/pci/pci.c:1.135 --- src/sys/dev/pci/pci.c:1.134 Sun Feb 27 18:10:25 2011 +++ src/sys/dev/pci/pci.c Wed Mar 2 21:57:40 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: pci.c,v 1.134 2011/02/27 18:10:25 jmcneill Exp $ */ +/* $NetBSD: pci.c,v 1.135 2011/03/02 21:57:40 matt Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 1998 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.134 2011/02/27 18:10:25 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.135 2011/03/02 21:57:40 matt Exp $"); #include "opt_pci.h" @@ -272,7 +272,7 @@ { pci_chipset_tag_t pc = sc->sc_pc; struct pci_attach_args pa; - pcireg_t id, csr, class, intr, bhlcr, bar; + pcireg_t id, csr, class, intr, bhlcr, bar, endbar; int ret, pin, bus, device, function, i, width; int locs[PCICF_NLOCS]; @@ -301,7 +301,12 @@ memset(sc->PCI_SC_DEVICESC(device, function).c_range, 0, sizeof(sc->PCI_SC_DEVICESC(device, function).c_range)); i = 0; - for (bar = PCI_MAPREG_START; bar < PCI_MAPREG_END; bar += width) { + switch (PCI_HDRTYPE_TYPE(bhlcr)) { + case PCI_HDRTYPE_PPB: endbar = PCI_MAPREG_PPB_END; break; + case PCI_HDRTYPE_PCB: endbar = PCI_MAPREG_PCB_END; break; + default: endbar = PCI_MAPREG_END; break; + } + for (bar = PCI_MAPREG_START; bar < endbar; bar += width) { struct pci_range *r; pcireg_t type;