Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Only probe the upper BAR of a mem64 BAR if bit 3...



details:   https://anonhg.NetBSD.org/src/rev/32e50aa7899f
branches:  trunk
changeset: 782189:32e50aa7899f
user:      matt <matt%NetBSD.org@localhost>
date:      Sat Oct 20 06:03:38 2012 +0000

description:
Only probe the upper BAR of a mem64 BAR if bit 31 is readonly

diffstat:

 sys/dev/pci/pci_map.c |  15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)

diffs (43 lines):

diff -r e23e4cd89c3e -r 32e50aa7899f sys/dev/pci/pci_map.c
--- a/sys/dev/pci/pci_map.c     Sat Oct 20 05:57:34 2012 +0000
+++ b/sys/dev/pci/pci_map.c     Sat Oct 20 06:03:38 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pci_map.c,v 1.29 2011/05/17 17:34:54 dyoung Exp $      */
+/*     $NetBSD: pci_map.c,v 1.30 2012/10/20 06:03:38 matt Exp $        */
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.29 2011/05/17 17:34:54 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_map.c,v 1.30 2012/10/20 06:03:38 matt Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -135,7 +135,8 @@
         *
         * 2) A device which wants 2^n bytes of memory will hardwire the bottom
         * n bits of the address to 0.  As recommended, we write all 1s and see
-        * what we get back.
+        * what we get back.  Only probe the upper BAR of a mem64 BAR if bit 31
+        * is readonly.
         */
        s = splhigh();
        address = pci_conf_read(pc, tag, reg);
@@ -144,9 +145,11 @@
        pci_conf_write(pc, tag, reg, address);
        if (is64bit) {
                address1 = pci_conf_read(pc, tag, reg + 4);
-               pci_conf_write(pc, tag, reg + 4, 0xffffffff);
-               mask1 = pci_conf_read(pc, tag, reg + 4);
-               pci_conf_write(pc, tag, reg + 4, address1);
+               if ((mask & 0x80000000) == 0) {
+                       pci_conf_write(pc, tag, reg + 4, 0xffffffff);
+                       mask1 = pci_conf_read(pc, tag, reg + 4);
+                       pci_conf_write(pc, tag, reg + 4, address1);
+               }
        }
        splx(s);
 



Home | Main Index | Thread Index | Old Index