Module Name:    xsrc
Committed By:   riz
Date:           Mon Mar  7 18:45:47 UTC 2011

Modified Files:
        xsrc/external/mit/libpciaccess/dist/src [netbsd-5]: netbsd_pci.c

Log Message:
Pull up following revision(s) (requested by jmcneill in ticket #1557):
        xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c: revision 1.8
        external/mit/xorg/lib/libpciaccess/Makefile: revision 1.5
        external/mit/xorg/lib/libpciaccess/Makefile: revision 1.6
Fix compilation with HAVE_MTRR
HAVE_MMTR -> HAVE_MTRR
only define HAVE_MTRR on x86


To generate a diff of this commit:
cvs rdiff -u -r1.4.2.3 -r1.4.2.4 \
    xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c
diff -u xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.4.2.3 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.4.2.4
--- xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.4.2.3	Sat Jan  9 01:59:59 2010
+++ xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c	Mon Mar  7 18:45:46 2011
@@ -135,7 +135,7 @@
 
 	if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
 		prot |= PROT_WRITE;
-	map->memory = mmap(NULL, map->size, prot, MAP_SHARED,
+	map->memory = mmap(NULL, (size_t)map->size, prot, MAP_SHARED,
 	    buses[dev->domain].fd, (off_t)map->base);
 	if (map->memory == MAP_FAILED)
 		return errno;
@@ -146,17 +146,19 @@
 	/* No need to set an MTRR if it's the default mode. */
 	if ((map->flags & PCI_DEV_MAP_FLAG_CACHABLE) ||
 	    (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)) {
-		m.base = base;
+		m.base = map->base;
 		m.flags = MTRR_VALID | MTRR_PRIVATE;
-		m.len = size;
+		m.len = map->size;
 		m.owner = getpid();
-		if (map->flags & PCI_DEV_MAP_FLAG_CACHEABLE)
+		if (map->flags & PCI_DEV_MAP_FLAG_CACHABLE)
 			m.type = MTRR_TYPE_WB;
 		if (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)
 			m.type = MTRR_TYPE_WC;
 
-		if ((netbsd_set_mtrr(&m, &n)) == -1)
-			ret = errno;
+		if ((netbsd_set_mtrr(&m, &n)) == -1) {
+			fprintf(stderr, "mtrr set failed: %s\n",
+			    strerror(errno));
+		}
 	}
 #endif
 
@@ -177,7 +179,7 @@
 	    (map->flags & PCI_DEV_MAP_FLAG_WRITE_COMBINE)) {
 		m.base = map->base;
 		m.flags = 0;
-		m.len = size;
+		m.len = map->size;
 		m.type = MTRR_TYPE_UC;
 		(void)netbsd_set_mtrr(&m, &n);
 	}

Reply via email to