[POWERPC] Port fixmap from x86 and use for kmap_atomic
[firefly-linux-kernel-4.4.55.git] / arch / powerpc / mm / pgtable_32.c
index 64c44bcc68de03f926ca67c74cac4a8db80a5239..80d1babb230d5d2547c754613d3c5aeaba5220ab 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <asm/pgtable.h>
 #include <asm/pgalloc.h>
+#include <asm/fixmap.h>
 #include <asm/io.h>
 
 #include "mmu_decl.h"
@@ -387,3 +388,25 @@ void kernel_map_pages(struct page *page, int numpages, int enable)
        change_page_attr(page, numpages, enable ? PAGE_KERNEL : __pgprot(0));
 }
 #endif /* CONFIG_DEBUG_PAGEALLOC */
+
+static int fixmaps;
+unsigned long FIXADDR_TOP = 0xfffff000;
+EXPORT_SYMBOL(FIXADDR_TOP);
+
+void __set_fixmap (enum fixed_addresses idx, phys_addr_t phys, pgprot_t flags)
+{
+       unsigned long address = __fix_to_virt(idx);
+
+       if (idx >= __end_of_fixed_addresses) {
+               BUG();
+               return;
+       }
+
+       map_page(address, phys, flags);
+       fixmaps++;
+}
+
+void __this_fixmap_does_not_exist(void)
+{
+       WARN_ON(1);
+}