poplar_layout.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. /*
  2. * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef POPLAR_LAYOUT_H
  7. #define POPLAR_LAYOUT_H
  8. /*
  9. * Boot memory layout definitions for the HiSilicon Poplar board
  10. */
  11. /*
  12. * When Poplar is powered on, boot ROM verifies the initial content of
  13. * boot media, loads it into low memory, and begins executing it
  14. * in 32-bit mode. The image loaded is "l-loader.bin", which contains
  15. * a small amount code along with an embedded ARM Trusted Firmware
  16. * BL1 image. The main purpose of "l-loader" is to prepare the
  17. * processor to execute the BL1 image in 64-bit mode, and to trigger
  18. * that execution.
  19. *
  20. * Also embedded in "l-loader.bin" is a FIP image that contains
  21. * other ARM Trusted Firmware images: BL2; BL31; and for BL33,
  22. * U-Boot. When BL1 executes, it unpacks the BL2 image from the FIP
  23. * image into a region of memory set aside to hold it. Similarly,
  24. * BL2 unpacks BL31 into memory reserved for it, and unpacks U-Boot
  25. * into high memory.
  26. *
  27. * Because the BL1 code is embedded in "l-loader", its base address
  28. * in memory is derived from the base address of the "l-loader"
  29. * text section, together with an offset. Memory space for BL2 is
  30. * reserved immediately following BL1, and memory space is reserved
  31. * for BL31 after that. ARM Trusted Firmware requires each of these
  32. * memory regions to be aligned on page boundaries, so the size of
  33. * each region is a multiple of a page size (ending in 000). Note
  34. * that ARM Trusted Firmware requires the read-only and read-write
  35. * regions of memory used for BL1 to be defined separately.
  36. *
  37. * ---------------------
  38. * | (unused memory) |
  39. * +-------------------+ - - - - -
  40. * | (l-loader text) | \
  41. * +-------------------+ \
  42. * | BL1 (read-only) | \ \
  43. * |- - - - - - - - - -| | |
  44. * | BL1 (read-write) | | |
  45. * +-------------------+ > BL Memory |
  46. * | Reserved for BL2 | | > "l-loader.bin" image
  47. * +-------------------+ | |
  48. * | Reserved for BL31 | / |
  49. * +-------------------+ |
  50. * . . . /
  51. * +-------------------+ /
  52. * | FIP | /
  53. * +-------------------+ - - - - -
  54. * . . .
  55. * | (unused memory) |
  56. * . . .
  57. * +-------------------+
  58. * |Reserved for U-Boot|
  59. * +-------------------+
  60. * . . .
  61. * | (unused memory) |
  62. * ---------------------
  63. *
  64. * The size of each of these regions is defined below. The base
  65. * address of the "l-loader" TEXT section and the offset of the BL1
  66. * image within that serve as anchors for defining the positions of
  67. * all other regions. The FIP is placed in a section of its own.
  68. *
  69. * A "BASE" is the memory address of the start of a region; a "LIMIT"
  70. * marks its end. A "SIZE" is the size of a region (in bytes). An
  71. * "OFFSET" is an offset to the start of a region relative to the
  72. * base of the "l-loader" TEXT section (also a multiple of page size).
  73. */
  74. #define LLOADER_TEXT_BASE 0x02001000 /* page aligned */
  75. #define BL1_OFFSET 0x0000D000 /* page multiple */
  76. #define FIP_BASE 0x02040000
  77. /*
  78. * FIP_BASE_EMMC = 0x40000 - 0x1000
  79. * = fip.bin offset - l-loader text offset
  80. * in l-loader.bin
  81. */
  82. #define FIP_BASE_EMMC 0x0003f000
  83. #define BL1_RO_SIZE 0x00008000 /* page multiple */
  84. #define BL1_RW_SIZE 0x00008000 /* page multiple */
  85. #define BL1_SIZE (BL1_RO_SIZE + BL1_RW_SIZE)
  86. #define BL2_SIZE 0x0000d000 /* page multiple */
  87. #define BL31_SIZE 0x00014000
  88. #if !POPLAR_RECOVERY
  89. /*
  90. * emmc partition1 4096KB
  91. * - l-loader.bin 1984KB
  92. * |- l-loader + bl1.bin 256KB
  93. * |- fip.bin 1728KB (0x001b0000)
  94. * - u-boot persistent data 64KB
  95. * - uefi persistent data 2048KB
  96. */
  97. #define FIP_SIZE 0x001b0000 /* absolute max */
  98. #else
  99. /*
  100. * same as above, but bootrom can only load an image (l-loader.bin) of
  101. * 1024KB max, so after deducting the size of l-loader + bl1.bin (256KB),
  102. * that leaves 768KB (0x000c0000) for fip.bin
  103. */
  104. #define FIP_SIZE 0x000c0000 /* absolute max */
  105. #endif
  106. /* BL1_OFFSET */ /* (Defined above) */
  107. #define BL1_BASE (LLOADER_TEXT_BASE + BL1_OFFSET)
  108. #define BL1_LIMIT (BL1_BASE + BL1_SIZE)
  109. #define BL1_RO_OFFSET (BL1_OFFSET)
  110. #define BL1_RO_BASE (LLOADER_TEXT_BASE + BL1_RO_OFFSET)
  111. #define BL1_RO_LIMIT (BL1_RO_BASE + BL1_RO_SIZE)
  112. #define BL1_RW_OFFSET (BL1_RO_OFFSET + BL1_RO_SIZE)
  113. #define BL1_RW_BASE (LLOADER_TEXT_BASE + BL1_RW_OFFSET)
  114. #define BL1_RW_LIMIT (BL1_RW_BASE + BL1_RW_SIZE)
  115. #define BL2_OFFSET (BL1_OFFSET + BL1_SIZE)
  116. #define BL2_BASE (LLOADER_TEXT_BASE + BL2_OFFSET)
  117. #define BL2_LIMIT (BL2_BASE + BL2_SIZE)
  118. #define BL31_OFFSET (BL2_OFFSET + BL2_SIZE)
  119. #define BL31_BASE (LLOADER_TEXT_BASE + BL31_OFFSET)
  120. #define BL31_LIMIT (BL31_BASE + BL31_SIZE)
  121. #endif /* POPLAR_LAYOUT_H */