修订版 | 65168910adaae3a4ac91fd5acf30941a28facc0e (tree) |
---|---|
时间 | 2022-07-26 15:23:54 |
作者 | Ashok Reddy Soma <ashok.reddy.soma@xili...> |
Commiter | Michal Simek |
zynqmp: Run board_get_usable_ram_top() only on main U-Boot
With commit ce39ee28ec31 ("zynqmp: Do not place u-boot to reserved memory
location"), the function board_get_usable_ram_top() is allocating
MMU_SECTION_SIZE of about 2MB using lmb_alloc(). But we dont have this
much memory in case of mini U-Boot.
Keep these functions which use lmb under CONFIG_LMB so that they are
compiled and used only when LMB is enabled.
Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/75e52def75f573e554a6b177a78504c128cb0c4a.1657183534.git.michal.simek@amd.com
@@ -29,9 +29,11 @@ static int boot_prep_linux(bootm_headers_t *images) | ||
29 | 29 | { |
30 | 30 | int ret; |
31 | 31 | |
32 | - ret = image_setup_linux(images); | |
33 | - if (ret) | |
34 | - return ret; | |
32 | + if (CONFIG_IS_ENABLED(LMB)) { | |
33 | + ret = image_setup_linux(images); | |
34 | + if (ret) | |
35 | + return ret; | |
36 | + } | |
35 | 37 | |
36 | 38 | return board_prep_linux(images); |
37 | 39 | } |
@@ -199,7 +199,7 @@ static void boot_prep_linux(bootm_headers_t *images) | ||
199 | 199 | { |
200 | 200 | char *commandline = env_get("bootargs"); |
201 | 201 | |
202 | - if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) { | |
202 | + if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) { | |
203 | 203 | debug("using: FDT\n"); |
204 | 204 | if (image_setup_linux(images)) { |
205 | 205 | panic("FDT creation failed!"); |
@@ -60,9 +60,11 @@ int do_bootm_linux(int flag, int argc, char *const argv[], | ||
60 | 60 | } |
61 | 61 | set_clocks_in_mhz(kbd); |
62 | 62 | |
63 | - ret = image_setup_linux(images); | |
64 | - if (ret) | |
65 | - goto error; | |
63 | + if (CONFIG_IS_ENABLED(LMB)) { | |
64 | + ret = image_setup_linux(images); | |
65 | + if (ret) | |
66 | + goto error; | |
67 | + } | |
66 | 68 | |
67 | 69 | kernel = (void (*)(struct bd_info *, ulong, ulong, ulong, ulong))images->ep; |
68 | 70 |
@@ -73,7 +73,7 @@ static void boot_jump_linux(bootm_headers_t *images, int flag) | ||
73 | 73 | |
74 | 74 | static void boot_prep_linux(bootm_headers_t *images) |
75 | 75 | { |
76 | - if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) { | |
76 | + if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) { | |
77 | 77 | debug("using: FDT\n"); |
78 | 78 | if (image_setup_linux(images)) { |
79 | 79 | printf("FDT creation failed! hanging..."); |
@@ -214,9 +214,11 @@ static int boot_body_linux(bootm_headers_t *images) | ||
214 | 214 | if (ret) |
215 | 215 | return ret; |
216 | 216 | |
217 | - ret = image_setup_linux(images); | |
218 | - if (ret) | |
219 | - return ret; | |
217 | + if (CONFIG_IS_ENABLED(LMB)) { | |
218 | + ret = image_setup_linux(images); | |
219 | + if (ret) | |
220 | + return ret; | |
221 | + } | |
220 | 222 | |
221 | 223 | return 0; |
222 | 224 | } |
@@ -64,7 +64,7 @@ static void announce_and_cleanup(int fake) | ||
64 | 64 | |
65 | 65 | static void boot_prep_linux(bootm_headers_t *images) |
66 | 66 | { |
67 | - if (CONFIG_IS_ENABLED(OF_LIBFDT) && images->ft_len) { | |
67 | + if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) { | |
68 | 68 | debug("using: FDT\n"); |
69 | 69 | if (image_setup_linux(images)) { |
70 | 70 | printf("FDT creation failed! hanging..."); |
@@ -78,15 +78,14 @@ static int boot_prep_linux(bootm_headers_t *images) | ||
78 | 78 | size_t len; |
79 | 79 | int ret; |
80 | 80 | |
81 | -#ifdef CONFIG_OF_LIBFDT | |
82 | - if (images->ft_len) { | |
81 | + if (CONFIG_IS_ENABLED(OF_LIBFDT) && CONFIG_IS_ENABLED(LMB) && images->ft_len) { | |
83 | 82 | debug("using: FDT\n"); |
84 | 83 | if (image_setup_linux(images)) { |
85 | 84 | puts("FDT creation failed! hanging..."); |
86 | 85 | hang(); |
87 | 86 | } |
88 | 87 | } |
89 | -#endif | |
88 | + | |
90 | 89 | if (images->legacy_hdr_valid) { |
91 | 90 | hdr = images->legacy_hdr_os; |
92 | 91 | if (image_check_type(hdr, IH_TYPE_MULTI)) { |
@@ -253,6 +253,7 @@ int dram_init(void) | ||
253 | 253 | return 0; |
254 | 254 | } |
255 | 255 | |
256 | +#if defined(CONFIG_LMB) | |
256 | 257 | ulong board_get_usable_ram_top(ulong total_size) |
257 | 258 | { |
258 | 259 | phys_size_t size; |
@@ -277,6 +278,8 @@ ulong board_get_usable_ram_top(ulong total_size) | ||
277 | 278 | |
278 | 279 | return reg + size; |
279 | 280 | } |
281 | +#endif | |
282 | + | |
280 | 283 | #else |
281 | 284 | int dram_init_banksize(void) |
282 | 285 | { |
@@ -537,6 +537,7 @@ int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images, | ||
537 | 537 | return 0; |
538 | 538 | } |
539 | 539 | |
540 | +#if defined(CONFIG_LMB) | |
540 | 541 | /** |
541 | 542 | * boot_ramdisk_high - relocate init ramdisk |
542 | 543 | * @lmb: pointer to lmb handle, will be used for memory mgmt |
@@ -630,6 +631,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len, | ||
630 | 631 | error: |
631 | 632 | return -1; |
632 | 633 | } |
634 | +#endif | |
633 | 635 | |
634 | 636 | int boot_get_setup(bootm_headers_t *images, u8 arch, |
635 | 637 | ulong *setup_start, ulong *setup_len) |
@@ -823,6 +825,7 @@ int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images, | ||
823 | 825 | return 0; |
824 | 826 | } |
825 | 827 | |
828 | +#if defined(CONFIG_LMB) | |
826 | 829 | #ifdef CONFIG_SYS_BOOT_GET_CMDLINE |
827 | 830 | /** |
828 | 831 | * boot_get_cmdline - allocate and initialize kernel cmdline |
@@ -932,6 +935,7 @@ int image_setup_linux(bootm_headers_t *images) | ||
932 | 935 | |
933 | 936 | return 0; |
934 | 937 | } |
938 | +#endif | |
935 | 939 | |
936 | 940 | void genimg_print_size(uint32_t size) |
937 | 941 | { |