]> Pileus Git - ~andy/linux/blobdiff - arch/sparc/mm/highmem.c
Merge tag 'tty-3.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
[~andy/linux] / arch / sparc / mm / highmem.c
index 055c66cf1bf4454347ebd7b2b0d3a1cabadff047..449f864f0cefdb8918bf0002d40dc87ba2cb8db3 100644 (file)
  * shared by CPUs, and so precious, and establishing them requires IPI.
  * Atomic kmaps are lightweight and we may have NCPUS more of them.
  */
-#include <linux/mm.h>
 #include <linux/highmem.h>
 #include <linux/export.h>
-#include <asm/pgalloc.h>
+#include <linux/mm.h>
+
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/fixmap.h>
+#include <asm/pgalloc.h>
+#include <asm/vaddrs.h>
+
+pgprot_t kmap_prot;
+
+static pte_t *kmap_pte;
+
+void __init kmap_init(void)
+{
+       unsigned long address;
+       pmd_t *dir;
+
+       address = __fix_to_virt(FIX_KMAP_BEGIN);
+       dir = pmd_offset(pgd_offset_k(address), address);
+
+        /* cache the first kmap pte */
+        kmap_pte = pte_offset_kernel(dir, address);
+        kmap_prot = __pgprot(SRMMU_ET_PTE | SRMMU_PRIV | SRMMU_CACHE);
+}
 
 void *kmap_atomic(struct page *page)
 {
@@ -110,21 +128,3 @@ void __kunmap_atomic(void *kvaddr)
        pagefault_enable();
 }
 EXPORT_SYMBOL(__kunmap_atomic);
-
-/* We may be fed a pagetable here by ptep_to_xxx and others. */
-struct page *kmap_atomic_to_page(void *ptr)
-{
-       unsigned long idx, vaddr = (unsigned long)ptr;
-       pte_t *pte;
-
-       if (vaddr < SRMMU_NOCACHE_VADDR)
-               return virt_to_page(ptr);
-       if (vaddr < PKMAP_BASE)
-               return pfn_to_page(__nocache_pa(vaddr) >> PAGE_SHIFT);
-       BUG_ON(vaddr < FIXADDR_START);
-       BUG_ON(vaddr > FIXADDR_TOP);
-
-       idx = virt_to_fix(vaddr);
-       pte = kmap_pte - (idx - FIX_KMAP_BEGIN);
-       return pte_page(*pte);
-}