Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci When probing the PCI bars, make sure to only pro...
details: https://anonhg.NetBSD.org/src/rev/8cff3fa6e98b
branches: trunk
changeset: 762844:8cff3fa6e98b
user: matt <matt%NetBSD.org@localhost>
date: Wed Mar 02 21:57:40 2011 +0000
description:
When probing the PCI bars, make sure to only probe BARS (PPBs and PCB has
fewer bars than type 0 devices).
diffstat:
sys/dev/pci/pci.c | 13 +++++++++----
1 files changed, 9 insertions(+), 4 deletions(-)
diffs (41 lines):
diff -r 1d11ee682286 -r 8cff3fa6e98b sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c Wed Mar 02 20:12:29 2011 +0000
+++ b/sys/dev/pci/pci.c Wed Mar 02 21:57:40 2011 +0000
@@ -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;
Home |
Main Index |
Thread Index |
Old Index