fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / mips / mm / highmem.c
index 14b020d..675502a 100644 (file)
@@ -1,4 +1,3 @@
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/highmem.h>
 #include <asm/tlbflush.h>
@@ -40,7 +39,7 @@ void *__kmap_atomic(struct page *page, enum km_type type)
        unsigned long vaddr;
 
        /* even !CONFIG_PREEMPT needs this, for in_atomic in do_page_fault */
-       inc_preempt_count();
+       pagefault_disable();
        if (!PageHighMem(page))
                return page_address(page);
 
@@ -63,8 +62,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
        enum fixed_addresses idx = type + KM_TYPE_NR*smp_processor_id();
 
        if (vaddr < FIXADDR_START) { // FIXME
-               dec_preempt_count();
-               preempt_check_resched();
+               pagefault_enable();
                return;
        }
 
@@ -75,14 +73,34 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
         * force other mappings to Oops if they'll try to access
         * this pte without first remap it
         */
-       pte_clear(kmap_pte-idx);
+       pte_clear(&init_mm, vaddr, kmap_pte-idx);
        local_flush_tlb_one(vaddr);
 #endif
 
-       dec_preempt_count();
-       preempt_check_resched();
+       pagefault_enable();
 }
 
+#ifndef CONFIG_LIMITED_DMA
+/*
+ * This is the same as kmap_atomic() but can map memory that doesn't
+ * have a struct page associated with it.
+ */
+void *kmap_atomic_pfn(unsigned long pfn, enum km_type type)
+{
+       enum fixed_addresses idx;
+       unsigned long vaddr;
+
+       pagefault_disable();
+
+       idx = type + KM_TYPE_NR*smp_processor_id();
+       vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
+       set_pte(kmap_pte-idx, pfn_pte(pfn, kmap_prot));
+       flush_tlb_one(vaddr);
+
+       return (void*) vaddr;
+}
+#endif /* CONFIG_LIMITED_DMA */
+
 struct page *__kmap_atomic_to_page(void *ptr)
 {
        unsigned long idx, vaddr = (unsigned long)ptr;