mem-layout.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Memory layout definitions for the Hexagon architecture
  4. *
  5. * Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
  6. */
  7. #ifndef _ASM_HEXAGON_MEM_LAYOUT_H
  8. #define _ASM_HEXAGON_MEM_LAYOUT_H
  9. #include <linux/const.h>
  10. /*
  11. * Have to do this for ginormous numbers, else they get printed as
  12. * negative numbers, which the linker no likey when you try to
  13. * assign it to the location counter.
  14. */
  15. #define PAGE_OFFSET _AC(0xc0000000, UL)
  16. /*
  17. * Compiling for a platform that needs a crazy physical offset
  18. * (like if the memory starts at 1GB and up) means we need
  19. * an actual PHYS_OFFSET. Should be set up in head.S.
  20. */
  21. #ifdef CONFIG_HEXAGON_PHYS_OFFSET
  22. #ifndef __ASSEMBLY__
  23. extern unsigned long __phys_offset;
  24. #endif
  25. #define PHYS_OFFSET __phys_offset
  26. #endif
  27. #ifndef PHYS_OFFSET
  28. #define PHYS_OFFSET 0
  29. #endif
  30. #define PHYS_PFN_OFFSET (PHYS_OFFSET >> PAGE_SHIFT)
  31. #define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
  32. #define TASK_SIZE (PAGE_OFFSET)
  33. /* not sure how these are used yet */
  34. #define STACK_TOP TASK_SIZE
  35. #define STACK_TOP_MAX TASK_SIZE
  36. #ifndef __ASSEMBLY__
  37. enum fixed_addresses {
  38. FIX_KMAP_BEGIN,
  39. FIX_KMAP_END, /* check for per-cpuism */
  40. __end_of_fixed_addresses
  41. };
  42. #define MIN_KERNEL_SEG (PAGE_OFFSET >> PGDIR_SHIFT) /* L1 shift is 22 bits */
  43. extern int max_kernel_seg;
  44. /*
  45. * Start of vmalloc virtual address space for kernel;
  46. * supposed to be based on the amount of physical memory available
  47. */
  48. #define VMALLOC_START ((unsigned long) __va(high_memory + VMALLOC_OFFSET))
  49. /* Gap between physical ram and vmalloc space for guard purposes. */
  50. #define VMALLOC_OFFSET PAGE_SIZE
  51. /*
  52. * Create the space between VMALLOC_START and FIXADDR_TOP backwards
  53. * from the ... "top".
  54. *
  55. * Permanent IO mappings will live at 0xfexx_xxxx
  56. * Hypervisor occupies the last 16MB page at 0xffxxxxxx
  57. */
  58. #define FIXADDR_TOP 0xfe000000
  59. #define FIXADDR_SIZE (__end_of_fixed_addresses << PAGE_SHIFT)
  60. #define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE)
  61. /*
  62. * "permanent kernel mappings", defined as long-lasting mappings of
  63. * high-memory page frames into the kernel address space.
  64. */
  65. #define LAST_PKMAP PTRS_PER_PTE
  66. #define LAST_PKMAP_MASK (LAST_PKMAP - 1)
  67. #define PKMAP_NR(virt) ((virt - PKMAP_BASE) >> PAGE_SHIFT)
  68. #define PKMAP_ADDR(nr) (PKMAP_BASE + ((nr) << PAGE_SHIFT))
  69. /*
  70. * To the "left" of the fixed map space is the kmap space
  71. *
  72. * "Permanent Kernel Mappings"; fancy (or less fancy) PTE table
  73. * that looks like it's actually walked.
  74. * Need to check the alignment/shift usage; some archs use
  75. * PMD_MASK on this value
  76. */
  77. #define PKMAP_BASE (FIXADDR_START-PAGE_SIZE*LAST_PKMAP)
  78. /*
  79. * 2 pages of guard gap between where vmalloc area ends
  80. * and pkmap_base begins.
  81. */
  82. #define VMALLOC_END (PKMAP_BASE-PAGE_SIZE*2)
  83. #endif /* !__ASSEMBLY__ */
  84. #endif /* _ASM_HEXAGON_MEM_LAYOUT_H */