fixmap.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #ifndef _ASM_SCORE_FIXMAP_H
  2. #define _ASM_SCORE_FIXMAP_H
  3. #include <asm/page.h>
  4. #define PHY_RAM_BASE 0x00000000
  5. #define PHY_IO_BASE 0x10000000
  6. #define VIRTUAL_RAM_BASE 0xa0000000
  7. #define VIRTUAL_IO_BASE 0xb0000000
  8. #define RAM_SPACE_SIZE 0x10000000
  9. #define IO_SPACE_SIZE 0x10000000
  10. /* Kernel unmapped, cached 512MB */
  11. #define KSEG1 0xa0000000
  12. /*
  13. * Here we define all the compile-time 'special' virtual
  14. * addresses. The point is to have a constant address at
  15. * compile time, but to set the physical address only
  16. * in the boot process. We allocate these special addresses
  17. * from the end of virtual memory (0xfffff000) backwards.
  18. * Also this lets us do fail-safe vmalloc(), we
  19. * can guarantee that these special addresses and
  20. * vmalloc()-ed addresses never overlap.
  21. *
  22. * these 'compile-time allocated' memory buffers are
  23. * fixed-size 4k pages. (or larger if used with an increment
  24. * highger than 1) use fixmap_set(idx,phys) to associate
  25. * physical memory with fixmap indices.
  26. *
  27. * TLB entries of such buffers will not be flushed across
  28. * task switches.
  29. */
  30. /*
  31. * on UP currently we will have no trace of the fixmap mechanizm,
  32. * no page table allocations, etc. This might change in the
  33. * future, say framebuffers for the console driver(s) could be
  34. * fix-mapped?
  35. */
  36. enum fixed_addresses {
  37. #define FIX_N_COLOURS 8
  38. FIX_CMAP_BEGIN,
  39. FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
  40. __end_of_fixed_addresses
  41. };
  42. /*
  43. * used by vmalloc.c.
  44. *
  45. * Leave one empty page between vmalloc'ed areas and
  46. * the start of the fixmap, and leave one page empty
  47. * at the top of mem..
  48. */
  49. #define FIXADDR_TOP ((unsigned long)(long)(int)0xfefe0000)
  50. #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
  51. #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
  52. #define __fix_to_virt(x) (FIXADDR_TOP - ((x) << PAGE_SHIFT))
  53. #define __virt_to_fix(x) \
  54. ((FIXADDR_TOP - ((x) & PAGE_MASK)) >> PAGE_SHIFT)
  55. extern void __this_fixmap_does_not_exist(void);
  56. /*
  57. * 'index to address' translation. If anyone tries to use the idx
  58. * directly without tranlation, we catch the bug with a NULL-deference
  59. * kernel oops. Illegal ranges of incoming indices are caught too.
  60. */
  61. static inline unsigned long fix_to_virt(const unsigned int idx)
  62. {
  63. return __fix_to_virt(idx);
  64. }
  65. static inline unsigned long virt_to_fix(const unsigned long vaddr)
  66. {
  67. return __virt_to_fix(vaddr);
  68. }
  69. #endif /* _ASM_SCORE_FIXMAP_H */