summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2015-06-24 22:23:14 +0200
committerMatthieu Herrb <matthieu@herrb.eu>2015-06-24 22:24:09 +0200
commit6271ed02ba9fbea886fb2d06f694c10f5e1610e5 (patch)
tree8672482c5d985af4622d69142b2f8f6f989282de
parent3e90b53b00b188a0db2c3a60c94582dc79ab14d2 (diff)
Attempt to establish a write combining mapping instead of relying on mttrs.
Setting the mttrs failson my thinkpad x1 rev 3, making the xorg-video-vesa driver painfully slow. This makes the machine somewhat usable. ok mpi@
-rw-r--r--src/openbsd_pci.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/openbsd_pci.c b/src/openbsd_pci.c
index b8b68ad..15cd900 100644
--- a/src/openbsd_pci.c
+++ b/src/openbsd_pci.c
@@ -193,12 +193,18 @@ pci_device_openbsd_map_range(struct pci_device *dev,
struct mem_range_desc mr;
struct mem_range_op mo;
int prot = PROT_READ;
+ off_t addr = map->base;
if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
prot |= PROT_WRITE;
+#ifdef MEMRANGE_WC_RANGE
+ if (map->flags & PCI_DEV_MAP_FLAG_WRITABLE)
+ addr += MEMRANGE_WC_RANGE;
+#endif
+
map->memory = mmap(NULL, map->size, prot, MAP_SHARED, aperturefd,
- map->base);
+ addr);
if (map->memory == MAP_FAILED)
return errno;
#if defined(__i386__) || defined(__amd64__)