···11+/*22+ * fixmap.h: compile-time virtual memory allocation33+ *44+ * This file is subject to the terms and conditions of the GNU General Public55+ * License. See the file "COPYING" in the main directory of this archive66+ * for more details.77+ *88+ * Copyright (C) 1998 Ingo Molnar99+ *1010+ * Copyright 2008 Freescale Semiconductor Inc.1111+ * Port to powerpc added by Kumar Gala1212+ *1313+ * Copyright 2011 Michal Simek <monstr@monstr.eu>1414+ * Copyright 2011 PetaLogix Qld Pty Ltd1515+ * Port to Microblaze1616+ */1717+1818+#ifndef _ASM_FIXMAP_H1919+#define _ASM_FIXMAP_H2020+2121+#ifndef __ASSEMBLY__2222+#include <linux/kernel.h>2323+#include <asm/page.h>2424+2525+#define FIXADDR_TOP ((unsigned long)(-PAGE_SIZE))2626+2727+/*2828+ * Here we define all the compile-time 'special' virtual2929+ * addresses. The point is to have a constant address at3030+ * compile time, but to set the physical address only3131+ * in the boot process. We allocate these special addresses3232+ * from the end of virtual memory (0xfffff000) backwards.3333+ * Also this lets us do fail-safe vmalloc(), we3434+ * can guarantee that these special addresses and3535+ * vmalloc()-ed addresses never overlap.3636+ *3737+ * these 'compile-time allocated' memory buffers are3838+ * fixed-size 4k pages. (or larger if used with an increment3939+ * highger than 1) use fixmap_set(idx,phys) to associate4040+ * physical memory with fixmap indices.4141+ *4242+ * TLB entries of such buffers will not be flushed across4343+ * task switches.4444+ */4545+enum fixed_addresses {4646+ FIX_HOLE,4747+ __end_of_fixed_addresses4848+};4949+5050+extern void __set_fixmap(enum fixed_addresses idx,5151+ phys_addr_t phys, pgprot_t flags);5252+5353+#define set_fixmap(idx, phys) \5454+ __set_fixmap(idx, phys, PAGE_KERNEL)5555+/*5656+ * Some hardware wants to get fixmapped without caching.5757+ */5858+#define set_fixmap_nocache(idx, phys) \5959+ __set_fixmap(idx, phys, PAGE_KERNEL_CI)6060+6161+#define clear_fixmap(idx) \6262+ __set_fixmap(idx, 0, __pgprot(0))6363+6464+#define __FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)6565+#define FIXADDR_START (FIXADDR_TOP - __FIXADDR_SIZE)6666+6767+#define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))6868+#define __virt_to_fix(x) ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)6969+7070+extern void __this_fixmap_does_not_exist(void);7171+7272+/*7373+ * 'index to address' translation. If anyone tries to use the idx7474+ * directly without tranlation, we catch the bug with a NULL-deference7575+ * kernel oops. Illegal ranges of incoming indices are caught too.7676+ */7777+static __always_inline unsigned long fix_to_virt(const unsigned int idx)7878+{7979+ /*8080+ * this branch gets completely eliminated after inlining,8181+ * except when someone tries to use fixaddr indices in an8282+ * illegal way. (such as mixing up address types or using8383+ * out-of-range indices).8484+ *8585+ * If it doesn't get removed, the linker will complain8686+ * loudly with a reasonably clear error message..8787+ */8888+ if (idx >= __end_of_fixed_addresses)8989+ __this_fixmap_does_not_exist();9090+9191+ return __fix_to_virt(idx);9292+}9393+9494+static inline unsigned long virt_to_fix(const unsigned long vaddr)9595+{9696+ BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);9797+ return __virt_to_fix(vaddr);9898+}9999+100100+#endif /* !__ASSEMBLY__ */101101+#endif
+11-6
arch/microblaze/mm/init.c
···2424#include <asm/pgalloc.h>2525#include <asm/sections.h>2626#include <asm/tlb.h>2727+#include <asm/fixmap.h>27282829/* Use for MMU and noMMU because of PCI generic code */2930int mem_init_done;···5554static void __init paging_init(void)5655{5756 unsigned long zones_size[MAX_NR_ZONES];5757+#ifdef CONFIG_MMU5858+ int idx;5959+6060+ /* Setup fixmaps */6161+ for (idx = 0; idx < __end_of_fixed_addresses; idx++)6262+ clear_fixmap(idx);6363+#endif58645965 /* Clean every zones */6066 memset(zones_size, 0, sizeof(zones_size));···324316 /* Map in all of RAM starting at CONFIG_KERNEL_START */325317 mapin_ram();326318327327-#ifdef CONFIG_HIGHMEM_START_BOOL328328- ioremap_base = CONFIG_HIGHMEM_START;329329-#else330330- ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */331331-#endif /* CONFIG_HIGHMEM_START_BOOL */332332- ioremap_bot = ioremap_base;319319+ /* Extend vmalloc and ioremap area as big as possible */320320+ ioremap_base = ioremap_bot = FIXADDR_START;321321+333322 /* Initialize the context management stuff */334323 mmu_context_init();335324