aboutsummaryrefslogtreecommitdiff
path: root/linux-core/drm_compat.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@panoply-rh.(none)>2008-03-05 10:37:02 +1000
committerDave Airlie <airlied@panoply-rh.(none)>2008-03-05 10:37:02 +1000
commit43891ff2d0176f013796b3c2a340b7d379d703ee (patch)
tree734cdcd6e6c36997f1db92d41b92e4557ebf13b1 /linux-core/drm_compat.c
parent81db48536c9d7bb23c448af6a6f1de81df755585 (diff)
parenta6a2f2c8c491617de702dc7d62bb55cbada4d42b (diff)
Merge remote branch 'origin/master' into modesetting-101
Conflicts: linux-core/drm_compat.c
Diffstat (limited to 'linux-core/drm_compat.c')
-rw-r--r--linux-core/drm_compat.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/linux-core/drm_compat.c b/linux-core/drm_compat.c
index e95269ec..b7b8e395 100644
--- a/linux-core/drm_compat.c
+++ b/linux-core/drm_compat.c
@@ -779,3 +779,32 @@ struct pci_dev * pci_get_bus_and_slot(unsigned int bus, unsigned int devfn)
}
EXPORT_SYMBOL(pci_get_bus_and_slot);
#endif
+
+#if defined(DRM_KMAP_ATOMIC_PROT_PFN) && defined(CONFIG_HIMEM)
+#define drm_kmap_get_fixmap_pte(vaddr) \
+ pte_offset_kernel(pmd_offset(pud_offset(pgd_offset_k(vaddr), vaddr), (vaddr)), (vaddr))
+
+void *kmap_atomic_prot_pfn(unsigned long pfn, enum km_type type,
+ pgprot_t protection)
+{
+ enum fixed_addresses idx;
+ unsigned long vaddr;
+ static pte_t *km_pte;
+ static int initialized = 0;
+
+ if (unlikely(!initialized)) {
+ km_pte = drm_kmap_get_fixmap_pte(__fix_to_virt(FIX_KMAP_BEGIN));
+ initialized = 1;
+ }
+
+ pagefault_disable();
+ idx = type + KM_TYPE_NR*smp_processor_id();
+ vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
+ set_pte(km_pte-idx, pfn_pte(pfn, protection));
+
+ return (void*) vaddr;
+}
+
+EXPORT_SYMBOL(kmap_atomic_prot_pfn);
+
+