tegra-common-post.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /*
  2. * (C) Copyright 2010-2012
  3. * NVIDIA Corporation <www.nvidia.com>
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. #ifndef __TEGRA_COMMON_POST_H
  24. #define __TEGRA_COMMON_POST_H
  25. #ifdef CONFIG_BOOTCOMMAND
  26. #define BOOTCMDS_COMMON ""
  27. #else
  28. #ifdef CONFIG_CMD_EXT2
  29. #define BOOT_FSTYPE_EXT2 "ext2 "
  30. #else
  31. #define BOOT_FSTYPE_EXT2 ""
  32. #endif
  33. #ifdef CONFIG_CMD_FAT
  34. #define BOOT_FSTYPE_FAT "fat"
  35. #else
  36. #define BOOT_FSTYPE_FAT ""
  37. #endif
  38. #ifdef CONFIG_CMD_MMC
  39. #define BOOTCMDS_MMC \
  40. "mmc_boot=" \
  41. "setenv devtype mmc; " \
  42. "if mmc dev ${devnum}; then " \
  43. "run scan_boot; " \
  44. "fi\0" \
  45. "bootcmd_mmc0=setenv devnum 0; run mmc_boot;\0" \
  46. "bootcmd_mmc1=setenv devnum 1; run mmc_boot;\0"
  47. #define BOOT_TARGETS_MMC "mmc1 mmc0"
  48. #else
  49. #define BOOTCMDS_MMC ""
  50. #define BOOT_TARGETS_MMC ""
  51. #endif
  52. #ifdef CONFIG_CMD_USB
  53. #define BOOTCMD_INIT_USB "run usb_init; "
  54. #define BOOTCMDS_USB \
  55. "usb_init=" \
  56. "if ${usb_need_init}; then " \
  57. "set usb_need_init false; " \
  58. "usb start 0; " \
  59. "fi\0" \
  60. \
  61. "usb_boot=" \
  62. "setenv devtype usb; " \
  63. BOOTCMD_INIT_USB \
  64. "if usb dev ${devnum}; then " \
  65. "run scan_boot; " \
  66. "fi\0" \
  67. \
  68. "bootcmd_usb0=setenv devnum 0; run usb_boot;\0"
  69. #define BOOT_TARGETS_USB "usb0"
  70. #else
  71. #define BOOTCMD_INIT_USB ""
  72. #define BOOTCMDS_USB ""
  73. #define BOOT_TARGETS_USB ""
  74. #endif
  75. #ifdef CONFIG_CMD_DHCP
  76. #define BOOTCMDS_DHCP \
  77. "bootcmd_dhcp=" \
  78. BOOTCMD_INIT_USB \
  79. "if dhcp ${scriptaddr} boot.scr.uimg; then "\
  80. "source ${scriptaddr}; " \
  81. "fi\0"
  82. #define BOOT_TARGETS_DHCP "dhcp"
  83. #else
  84. #define BOOTCMDS_DHCP ""
  85. #define BOOT_TARGETS_DHCP ""
  86. #endif
  87. #define BOOTCMDS_COMMON \
  88. "rootpart=1\0" \
  89. \
  90. "script_boot=" \
  91. "if ${fs}load ${devtype} ${devnum}:${rootpart} " \
  92. "${scriptaddr} ${prefix}${script}; then " \
  93. "echo ${script} found! Executing ...;" \
  94. "source ${scriptaddr};" \
  95. "fi;\0" \
  96. \
  97. "scan_boot=" \
  98. "echo Scanning ${devtype} ${devnum}...; " \
  99. "for fs in ${boot_fstypes}; do " \
  100. "for prefix in ${boot_prefixes}; do " \
  101. "for script in ${boot_scripts}; do " \
  102. "run script_boot; " \
  103. "done; " \
  104. "done; " \
  105. "done;\0" \
  106. \
  107. "boot_targets=" \
  108. BOOT_TARGETS_MMC " " \
  109. BOOT_TARGETS_USB " " \
  110. BOOT_TARGETS_DHCP " " \
  111. "\0" \
  112. \
  113. "boot_fstypes=" \
  114. BOOT_FSTYPE_EXT2 " " \
  115. BOOT_FSTYPE_FAT " " \
  116. "\0" \
  117. \
  118. "boot_prefixes=/ /boot/\0" \
  119. \
  120. "boot_scripts=boot.scr.uimg boot.scr\0" \
  121. \
  122. BOOTCMDS_MMC \
  123. BOOTCMDS_USB \
  124. BOOTCMDS_DHCP
  125. #define CONFIG_BOOTCOMMAND \
  126. "for target in ${boot_targets}; do run bootcmd_${target}; done"
  127. #endif
  128. /*
  129. * Memory layout for where various images get loaded by boot scripts:
  130. *
  131. * scriptaddr can be pretty much anywhere that doesn't conflict with something
  132. * else. Put it above BOOTMAPSZ to eliminate conflicts.
  133. *
  134. * kernel_addr_r must be within the first 128M of RAM in order for the
  135. * kernel's CONFIG_AUTO_ZRELADDR option to work. Since the kernel will
  136. * decompress itself to 0x8000 after the start of RAM, kernel_addr_r
  137. * should not overlap that area, or the kernel will have to copy itself
  138. * somewhere else before decompression. Similarly, the address of any other
  139. * data passed to the kernel shouldn't overlap the start of RAM. Pushing
  140. * this up to 16M allows for a sizable kernel to be decompressed below the
  141. * compressed load address.
  142. *
  143. * fdt_addr_r simply shouldn't overlap anything else. Choosing 32M allows for
  144. * the compressed kernel to be up to 16M too.
  145. *
  146. * ramdisk_addr_r simply shouldn't overlap anything else. Choosing 33M allows
  147. * for the FDT/DTB to be up to 1M, which is hopefully plenty.
  148. */
  149. #define MEM_LAYOUT_ENV_SETTINGS \
  150. "scriptaddr=0x10000000\0" \
  151. "kernel_addr_r=0x01000000\0" \
  152. "fdt_addr_r=0x02000000\0" \
  153. "ramdisk_addr_r=0x02100000\0" \
  154. #define CONFIG_EXTRA_ENV_SETTINGS \
  155. TEGRA_DEVICE_SETTINGS \
  156. MEM_LAYOUT_ENV_SETTINGS \
  157. BOOTCMDS_COMMON
  158. /* overrides for SPL build here */
  159. #ifdef CONFIG_SPL_BUILD
  160. /* remove devicetree support */
  161. #ifdef CONFIG_OF_CONTROL
  162. #undef CONFIG_OF_CONTROL
  163. #endif
  164. /* remove I2C support */
  165. #ifdef CONFIG_TEGRA_I2C
  166. #undef CONFIG_TEGRA_I2C
  167. #endif
  168. #ifdef CONFIG_CMD_I2C
  169. #undef CONFIG_CMD_I2C
  170. #endif
  171. /* remove MMC support */
  172. #ifdef CONFIG_MMC
  173. #undef CONFIG_MMC
  174. #endif
  175. #ifdef CONFIG_GENERIC_MMC
  176. #undef CONFIG_GENERIC_MMC
  177. #endif
  178. #ifdef CONFIG_TEGRA_MMC
  179. #undef CONFIG_TEGRA_MMC
  180. #endif
  181. #ifdef CONFIG_CMD_MMC
  182. #undef CONFIG_CMD_MMC
  183. #endif
  184. /* remove partitions/filesystems */
  185. #ifdef CONFIG_DOS_PARTITION
  186. #undef CONFIG_DOS_PARTITION
  187. #endif
  188. #ifdef CONFIG_EFI_PARTITION
  189. #undef CONFIG_EFI_PARTITION
  190. #endif
  191. #ifdef CONFIG_CMD_EXT2
  192. #undef CONFIG_CMD_EXT2
  193. #endif
  194. #ifdef CONFIG_CMD_FAT
  195. #undef CONFIG_CMD_FAT
  196. #endif
  197. /* remove USB */
  198. #ifdef CONFIG_USB_EHCI
  199. #undef CONFIG_USB_EHCI
  200. #endif
  201. #ifdef CONFIG_USB_EHCI_TEGRA
  202. #undef CONFIG_USB_EHCI_TEGRA
  203. #endif
  204. #ifdef CONFIG_USB_STORAGE
  205. #undef CONFIG_USB_STORAGE
  206. #endif
  207. #ifdef CONFIG_CMD_USB
  208. #undef CONFIG_CMD_USB
  209. #endif
  210. /* remove part command support */
  211. #ifdef CONFIG_PARTITION_UUIDS
  212. #undef CONFIG_PARTITION_UUIDS
  213. #endif
  214. #ifdef CONFIG_CMD_PART
  215. #undef CONFIG_CMD_PART
  216. #endif
  217. #endif /* CONFIG_SPL_BUILD */
  218. #endif /* __TEGRA_COMMON_POST_H */