Module Name: src
Committed By: matt
Date: Sat Oct 20 06:03:38 UTC 2012
Modified Files:
src/sys/dev/pci: pci_map.c
Log Message:
Only probe the upper BAR of a mem64 BAR if bit 31 is readonly
To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/pci/pci_map.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_map.c
diff -u src/sys/dev/pci/pci_map.c:1.29 src/sys/dev/pci/pci_map.c:1.30
--- src/sys/dev/pci/pci_map.c:1.29 Tue May 17 17:34:54 2011
+++ src/sys/dev/pci/pci_map.c Sat Oct 20 06:03:38 2012
@@ -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 @@ pci_mem_find(pci_chipset_tag_t pc, pcita
*
* 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_mem_find(pci_chipset_tag_t pc, pcita
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);