Module Name:    src
Committed By:   msaitoh
Date:           Tue Jan 29 05:09:35 UTC 2019

Modified Files:
        src/sys/dev/pci: pciconf.c

Log Message:
 Fix a bug that PCI bridge's prefetchable memory area's configuration
didn't work correctly in pciconf.c::configure_bridge(). Note that this function
is only for "options PCI_NETBSD_CONFIGURE" machines.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/pci/pciconf.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/pciconf.c
diff -u src/sys/dev/pci/pciconf.c:1.37 src/sys/dev/pci/pciconf.c:1.38
--- src/sys/dev/pci/pciconf.c:1.37	Fri Sep  5 05:29:16 2014
+++ src/sys/dev/pci/pciconf.c	Tue Jan 29 05:09:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pciconf.c,v 1.37 2014/09/05 05:29:16 matt Exp $	*/
+/*	$NetBSD: pciconf.c,v 1.38 2019/01/29 05:09:35 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.37 2014/09/05 05:29:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciconf.c,v 1.38 2019/01/29 05:09:35 msaitoh Exp $");
 
 #include "opt_pci.h"
 
@@ -855,6 +855,7 @@ configure_bridge(pciconf_dev_t *pd)
 	pciconf_bus_t	*pb;
 	pcireg_t	io, iohigh, mem, cmd;
 	int		rv;
+	bool		isprefetchmem64;
 
 	pb = pd->ppb;
 	/* Configure I/O base & limit*/
@@ -919,8 +920,9 @@ configure_bridge(pciconf_dev_t *pd)
 		mem_limit = 0x000000;
 	}
 	mem = pci_conf_read(pb->pc, pd->tag, PCI_BRIDGE_PREFETCHMEM_REG);
+	isprefetchmem64 = PCI_BRIDGE_PREFETCHMEM_64BITS(mem);
 #if ULONG_MAX > 0xffffffff
-	if (!PCI_BRIDGE_PREFETCHMEM_64BITS(mem) && mem_limit > 0xFFFFFFFFULL) {
+	if (!isprefetchmem64 && mem_limit > 0xFFFFFFFFULL) {
 		printf("Bus %d bridge does not support 64-bit PMEM.  ",
 		    pb->busno);
 		printf("Disabling prefetchable-MEM accesses\n");
@@ -936,7 +938,7 @@ configure_bridge(pciconf_dev_t *pd)
 	/*
 	 * XXX -- 64-bit systems need a lot more than just this...
 	 */
-	if (PCI_BRIDGE_PREFETCHMEM_64BITS(mem)) {
+	if (isprefetchmem64) {
 		mem_base  = (uint64_t) mem_base  >> 32;
 		mem_limit = (uint64_t) mem_limit >> 32;
 		pci_conf_write(pb->pc, pd->tag, PCI_BRIDGE_PREFETCHBASE32_REG,

Reply via email to