Module Name: xsrc
Committed By: jmcneill
Date: Wed Jan 12 19:03:51 UTC 2011
Modified Files:
xsrc/external/mit/libpciaccess/dist/src: netbsd_pci.c
Log Message:
Fix compilation with HAVE_MTRR
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 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.7 xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.8
--- xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c:1.7 Thu Nov 18 04:47:00 2010
+++ xsrc/external/mit/libpciaccess/dist/src/netbsd_pci.c Wed Jan 12 19:03:50 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);
}