]>
Commit | Line | Data |
---|---|---|
507bbe3e | 1 | /* |
cfc67116 | 2 | * (C) Copyright 2007 Michal Simek |
507bbe3e WD |
3 | * (C) Copyright 2004 Atmark Techno, Inc. |
4 | * | |
cfc67116 | 5 | * Michal SIMEK <monstr@monstr.eu> |
507bbe3e WD |
6 | * Yasushi SHOJI <yashi@atmark-techno.com> |
7 | * | |
3765b3e7 | 8 | * SPDX-License-Identifier: GPL-2.0+ |
507bbe3e WD |
9 | */ |
10 | ||
11 | #include <common.h> | |
12 | #include <command.h> | |
73223f0e | 13 | #include <fdt_support.h> |
cfc67116 | 14 | #include <image.h> |
a31e091a | 15 | #include <u-boot/zlib.h> |
cfc67116 | 16 | #include <asm/byteorder.h> |
507bbe3e | 17 | |
cfc67116 MS |
18 | DECLARE_GLOBAL_DATA_PTR; |
19 | ||
63c09417 MY |
20 | int arch_fixup_fdt(void *blob) |
21 | { | |
22 | return 0; | |
23 | } | |
24 | ||
1e71fa43 MS |
25 | int do_bootm_linux(int flag, int argc, char * const argv[], |
26 | bootm_headers_t *images) | |
507bbe3e | 27 | { |
cfc67116 | 28 | /* First parameter is mapped to $r5 for kernel boot args */ |
1e71fa43 | 29 | void (*thekernel) (char *, ulong, ulong); |
00caae6d | 30 | char *commandline = env_get("bootargs"); |
398b1d57 | 31 | ulong rd_data_start, rd_data_end; |
cfc67116 | 32 | |
2cb0e55a AB |
33 | /* |
34 | * allow the PREP bootm subcommand, it is required for bootm to work | |
35 | */ | |
36 | if (flag & BOOTM_STATE_OS_PREP) | |
37 | return 0; | |
38 | ||
49c3a861 KG |
39 | if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) |
40 | return 1; | |
41 | ||
398b1d57 AB |
42 | int ret; |
43 | ||
44 | char *of_flat_tree = NULL; | |
45 | #if defined(CONFIG_OF_LIBFDT) | |
5a75e121 JR |
46 | /* did generic code already find a device tree? */ |
47 | if (images->ft_len) | |
48 | of_flat_tree = images->ft_addr; | |
398b1d57 AB |
49 | #endif |
50 | ||
1e71fa43 | 51 | thekernel = (void (*)(char *, ulong, ulong))images->ep; |
398b1d57 AB |
52 | |
53 | /* find ramdisk */ | |
1e71fa43 | 54 | ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_MICROBLAZE, |
398b1d57 AB |
55 | &rd_data_start, &rd_data_end); |
56 | if (ret) | |
57 | return 1; | |
cfc67116 | 58 | |
770605e4 | 59 | bootstage_mark(BOOTSTAGE_ID_RUN_OS); |
cfc67116 | 60 | |
983c72f4 SG |
61 | if (!of_flat_tree && argc > 1) |
62 | of_flat_tree = (char *)simple_strtoul(argv[1], NULL, 16); | |
a8425d52 MS |
63 | |
64 | /* fixup the initrd now that we know where it should be */ | |
65 | if (images->rd_start && images->rd_end && of_flat_tree) | |
66 | ret = fdt_initrd(of_flat_tree, images->rd_start, | |
dbe963ae | 67 | images->rd_end); |
a8425d52 MS |
68 | if (ret) |
69 | return 1; | |
70 | ||
cfc67116 | 71 | #ifdef DEBUG |
1e71fa43 MS |
72 | printf("## Transferring control to Linux (at address 0x%08lx) ", |
73 | (ulong)thekernel); | |
74 | printf("ramdisk 0x%08lx, FDT 0x%08lx...\n", | |
75 | rd_data_start, (ulong) of_flat_tree); | |
cfc67116 MS |
76 | #endif |
77 | ||
9b4d9056 | 78 | #ifdef XILINX_USE_DCACHE |
9b4d9056 | 79 | flush_cache(0, XILINX_DCACHE_BYTE_SIZE); |
9b4d9056 | 80 | #endif |
398b1d57 AB |
81 | /* |
82 | * Linux Kernel Parameters (passing device tree): | |
83 | * r5: pointer to command line | |
84 | * r6: pointer to ramdisk | |
85 | * r7: pointer to the fdt, followed by the board info data | |
86 | */ | |
1e71fa43 | 87 | thekernel(commandline, rd_data_start, (ulong)of_flat_tree); |
cd7c596e | 88 | /* does not return */ |
a3a08c0c | 89 | |
40d7e99d | 90 | return 1; |
507bbe3e | 91 | } |