1 /* 2 * fixmap.h: compile-time virtual memory allocation 3 */ 4 #ifndef __ASM_FIXMAP_H 5 #define __ASM_FIXMAP_H 6 7 #include <xen/acpi.h> 8 #include <xen/pmap.h> 9 10 /* Fixmap slots */ 11 #define FIX_CONSOLE 0 /* The primary UART */ 12 #define FIX_MISC 1 /* Ephemeral mappings of hardware */ 13 #define FIX_ACPI_BEGIN 2 /* Start mappings of ACPI tables */ 14 #define FIX_ACPI_END (FIX_ACPI_BEGIN + NUM_FIXMAP_ACPI_PAGES - 1) /* End mappings of ACPI tables */ 15 #define FIX_PMAP_BEGIN (FIX_ACPI_END + 1) /* Start of PMAP */ 16 #define FIX_PMAP_END (FIX_PMAP_BEGIN + NUM_FIX_PMAP - 1) /* End of PMAP */ 17 18 #define FIX_LAST FIX_PMAP_END 19 20 #define FIXADDR_START FIXMAP_ADDR(0) 21 #define FIXADDR_TOP FIXMAP_ADDR(FIX_LAST + 1) 22 23 #ifndef __ASSEMBLY__ 24 25 /* 26 * Direct access to xen_fixmap[] should only happen when {set, 27 * clear}_fixmap() is unusable (e.g. where we would end up to 28 * recursively call the helpers). 29 */ 30 extern lpae_t xen_fixmap[XEN_PT_LPAE_ENTRIES]; 31 32 /* Map a page in a fixmap entry */ 33 extern void set_fixmap(unsigned int map, mfn_t mfn, unsigned int flags); 34 /* Remove a mapping from a fixmap entry */ 35 extern void clear_fixmap(unsigned int map); 36 37 #define fix_to_virt(slot) ((void *)FIXMAP_ADDR(slot)) 38 virt_to_fix(vaddr_t vaddr)39static inline unsigned int virt_to_fix(vaddr_t vaddr) 40 { 41 BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START); 42 43 return ((vaddr - FIXADDR_START) >> PAGE_SHIFT); 44 } 45 46 #endif /* __ASSEMBLY__ */ 47 48 #endif /* __ASM_FIXMAP_H */ 49