Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Skip 64bit BAR correctly. I don't know if this b...



details:   https://anonhg.NetBSD.org/src/rev/faa8aac9a740
branches:  trunk
changeset: 784713:faa8aac9a740
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Feb 07 02:10:18 2013 +0000

description:
Skip 64bit BAR correctly. I don't know if this bug causes a real problem.

diffstat:

 sys/dev/pci/if_wm.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r ec59b3167854 -r faa8aac9a740 sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Thu Feb 07 01:24:04 2013 +0000
+++ b/sys/dev/pci/if_wm.c       Thu Feb 07 02:10:18 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.240 2013/01/30 14:20:53 msaitoh Exp $      */
+/*     $NetBSD: if_wm.c,v 1.241 2013/02/07 02:10:18 msaitoh Exp $      */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.240 2013/01/30 14:20:53 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.241 2013/02/07 02:10:18 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1217,11 +1217,14 @@
        if (sc->sc_type >= WM_T_82544) {
                /* First we have to find the I/O BAR. */
                for (i = PCI_MAPREG_START; i < PCI_MAPREG_END; i += 4) {
-                       if (pci_mapreg_type(pa->pa_pc, pa->pa_tag, i) ==
-                           PCI_MAPREG_TYPE_IO)
+                       memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, i);
+                       if (memtype == PCI_MAPREG_TYPE_IO)
                                break;
+                       if (PCI_MAPREG_MEM_TYPE(memtype) ==
+                           PCI_MAPREG_MEM_TYPE_64BIT)
+                               i += 4; /* skip high bits, too */
                }
-               if (i != PCI_MAPREG_END) {
+               if (i < PCI_MAPREG_END) {
                        /*
                         * We found PCI_MAPREG_TYPE_IO. Note that 82580
                         * (and newer?) chip has no PCI_MAPREG_TYPE_IO.



Home | Main Index | Thread Index | Old Index