This needs my last diff that adds MEMRANGE_WC_RANGE to become
functional.  Then it will use the PAT (on CPUs that have PAT) to
establish write combining mappings.  Modern systems don't seem to
properly set up MTRRs anymore, and this is a lot easier than setting
up mtrr's ourselves.

ok?


Index: src/openbsd_pci.c
===================================================================
RCS file: /cvs/xenocara/lib/libpciaccess/src/openbsd_pci.c,v
retrieving revision 1.23
diff -u -p -r1.23 openbsd_pci.c
--- src/openbsd_pci.c   10 May 2015 09:31:51 -0000      1.23
+++ src/openbsd_pci.c   22 Jun 2015 19:00:46 -0000
@@ -192,12 +192,18 @@ pci_device_openbsd_map_range(struct pci_
        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__)

Reply via email to