Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2008 Semihalf |
| 3 | * |
| 4 | * (C) Copyright 2000-2006 |
| 5 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 6 | * |
| 7 | * See file CREDITS for list of people who contributed to this |
| 8 | * project. |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or |
| 11 | * modify it under the terms of the GNU General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 of |
| 13 | * the License, or (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 23 | * MA 02111-1307 USA |
| 24 | */ |
| 25 | |
Marian Balakowicz | 7582438 | 2008-01-31 13:20:06 +0100 | [diff] [blame] | 26 | #define DEBUG |
| 27 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 28 | #include <common.h> |
| 29 | #include <watchdog.h> |
| 30 | #include <command.h> |
| 31 | #include <image.h> |
| 32 | #include <malloc.h> |
| 33 | #include <zlib.h> |
| 34 | #include <bzlib.h> |
| 35 | #include <environment.h> |
| 36 | #include <asm/byteorder.h> |
| 37 | |
| 38 | #if defined(CONFIG_OF_LIBFDT) |
| 39 | #include <fdt.h> |
| 40 | #include <libfdt.h> |
| 41 | #include <fdt_support.h> |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 42 | |
| 43 | static void fdt_error (const char *msg); |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 44 | static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 45 | bootm_headers_t *images, char **of_flat_tree, ulong *of_size); |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 46 | static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 47 | cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
| 48 | char **of_flat_tree, ulong *of_size); |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 49 | #endif |
| 50 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 51 | #ifdef CFG_INIT_RAM_LOCK |
| 52 | #include <asm/cache.h> |
| 53 | #endif |
| 54 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 55 | DECLARE_GLOBAL_DATA_PTR; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 56 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 57 | extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 58 | extern ulong get_effective_memsize(void); |
Marian Balakowicz | ceaed2b | 2008-01-31 13:57:17 +0100 | [diff] [blame] | 59 | static ulong get_sp (void); |
Marian Balakowicz | b6b0fe6 | 2008-01-31 13:58:13 +0100 | [diff] [blame] | 60 | static void set_clocks_in_mhz (bd_t *kbd); |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 61 | |
Kumar Gala | d3f2fa0 | 2008-02-27 21:51:50 -0600 | [diff] [blame] | 62 | #ifndef CFG_LINUX_LOWMEM_MAX_SIZE |
| 63 | #define CFG_LINUX_LOWMEM_MAX_SIZE (768*1024*1024) |
| 64 | #endif |
| 65 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 66 | void __attribute__((noinline)) |
Marian Balakowicz | 8a5ea3e | 2008-02-27 11:01:04 +0100 | [diff] [blame] | 67 | do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
| 68 | bootm_headers_t *images) |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 69 | { |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 70 | ulong sp; |
Marian Balakowicz | b6b0fe6 | 2008-01-31 13:58:13 +0100 | [diff] [blame] | 71 | |
Marian Balakowicz | f13e7b2 | 2008-01-08 18:12:17 +0100 | [diff] [blame] | 72 | ulong initrd_start, initrd_end; |
Marian Balakowicz | 5ad03eb | 2008-01-31 13:55:39 +0100 | [diff] [blame] | 73 | ulong rd_data_start, rd_data_end, rd_len; |
Kumar Gala | d3f2fa0 | 2008-02-27 21:51:50 -0600 | [diff] [blame] | 74 | ulong size; |
Marian Balakowicz | f13e7b2 | 2008-01-08 18:12:17 +0100 | [diff] [blame] | 75 | |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 76 | ulong cmd_start, cmd_end, bootmap_base; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 77 | bd_t *kbd; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 78 | ulong ep = 0; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 79 | void (*kernel)(bd_t *, ulong, ulong, ulong, ulong); |
Kumar Gala | d2bc095 | 2008-02-27 21:51:45 -0600 | [diff] [blame] | 80 | int ret; |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 81 | ulong of_size = 0; |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 82 | struct lmb *lmb = images->lmb; |
Marian Balakowicz | f13e7b2 | 2008-01-08 18:12:17 +0100 | [diff] [blame] | 83 | |
Marian Balakowicz | 4a2ad5f | 2008-01-31 13:20:07 +0100 | [diff] [blame] | 84 | #if defined(CONFIG_OF_LIBFDT) |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 85 | char *of_flat_tree = NULL; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 86 | #endif |
| 87 | |
Kumar Gala | d3f2fa0 | 2008-02-27 21:51:50 -0600 | [diff] [blame] | 88 | bootmap_base = getenv_bootm_low(); |
| 89 | size = getenv_bootm_size(); |
| 90 | |
| 91 | #ifdef DEBUG |
| 92 | if (((u64)bootmap_base + size) > (CFG_SDRAM_BASE + (u64)gd->ram_size)) |
| 93 | puts("WARNING: bootm_low + bootm_size exceed total memory\n"); |
| 94 | if ((bootmap_base + size) > get_effective_memsize()) |
| 95 | puts("WARNING: bootm_low + bootm_size exceed eff. memory\n"); |
| 96 | #endif |
| 97 | |
| 98 | size = min(size, get_effective_memsize()); |
| 99 | size = min(size, CFG_LINUX_LOWMEM_MAX_SIZE); |
| 100 | |
| 101 | if (size < getenv_bootm_size()) { |
| 102 | ulong base = bootmap_base + size; |
| 103 | printf("WARNING: adjusting available memory to %x\n", size); |
| 104 | lmb_reserve(lmb, base, getenv_bootm_size() - size); |
| 105 | } |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 106 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 107 | /* |
| 108 | * Booting a (Linux) kernel image |
| 109 | * |
| 110 | * Allocate space for command line and board info - the |
| 111 | * address should be as high as possible within the reach of |
| 112 | * the kernel (see CFG_BOOTMAPSZ settings), but in unused |
| 113 | * memory, which means far enough below the current stack |
| 114 | * pointer. |
| 115 | */ |
Marian Balakowicz | b6b0fe6 | 2008-01-31 13:58:13 +0100 | [diff] [blame] | 116 | sp = get_sp(); |
Kumar Gala | d3f2fa0 | 2008-02-27 21:51:50 -0600 | [diff] [blame] | 117 | debug ("## Current stack ends at 0x%08lx\n", sp); |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 118 | |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 119 | /* adjust sp by 1K to be safe */ |
| 120 | sp -= 1024; |
| 121 | lmb_reserve(lmb, sp, (CFG_SDRAM_BASE + get_effective_memsize() - sp)); |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 122 | |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 123 | #if defined(CONFIG_OF_LIBFDT) |
| 124 | /* find flattened device tree */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 125 | ret = boot_get_fdt (cmdtp, flag, argc, argv, images, &of_flat_tree, &of_size); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 126 | |
| 127 | if (ret) |
| 128 | goto error; |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 129 | #endif |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 130 | |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 131 | if (!of_size) { |
| 132 | /* allocate space and init command line */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 133 | ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base); |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 134 | if (ret) { |
| 135 | puts("ERROR with allocation of cmdline\n"); |
| 136 | goto error; |
| 137 | } |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 138 | |
| 139 | /* allocate space for kernel copy of board info */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 140 | ret = boot_get_kbd (lmb, &kbd, bootmap_base); |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 141 | if (ret) { |
| 142 | puts("ERROR with allocation of kernel bd\n"); |
| 143 | goto error; |
| 144 | } |
Kumar Gala | 2795349 | 2008-02-27 21:51:44 -0600 | [diff] [blame] | 145 | set_clocks_in_mhz(kbd); |
| 146 | } |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 147 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 148 | /* find kernel entry point */ |
| 149 | if (images->legacy_hdr_valid) { |
| 150 | ep = image_get_ep (images->legacy_hdr_os); |
| 151 | #if defined(CONFIG_FIT) |
| 152 | } else if (images->fit_uname_os) { |
| 153 | fit_unsupported_reset ("PPC linux bootm"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 154 | goto error; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 155 | #endif |
| 156 | } else { |
| 157 | puts ("Could not find kernel entry point!\n"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 158 | goto error; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 159 | } |
| 160 | kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 161 | |
Marian Balakowicz | ceaed2b | 2008-01-31 13:57:17 +0100 | [diff] [blame] | 162 | /* find ramdisk */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 163 | ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images, |
Marian Balakowicz | 5ad03eb | 2008-01-31 13:55:39 +0100 | [diff] [blame] | 164 | IH_ARCH_PPC, &rd_data_start, &rd_data_end); |
Marian Balakowicz | ceaed2b | 2008-01-31 13:57:17 +0100 | [diff] [blame] | 165 | |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 166 | if (ret) |
| 167 | goto error; |
| 168 | |
Marian Balakowicz | 5ad03eb | 2008-01-31 13:55:39 +0100 | [diff] [blame] | 169 | rd_len = rd_data_end - rd_data_start; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 170 | |
Marian Balakowicz | 4a2ad5f | 2008-01-31 13:20:07 +0100 | [diff] [blame] | 171 | #if defined(CONFIG_OF_LIBFDT) |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 172 | ret = boot_relocate_fdt (lmb, bootmap_base, |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 173 | cmdtp, flag, argc, argv, &of_flat_tree, &of_size); |
Marian Balakowicz | 4a2ad5f | 2008-01-31 13:20:07 +0100 | [diff] [blame] | 174 | |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 175 | /* |
| 176 | * Add the chosen node if it doesn't exist, add the env and bd_t |
| 177 | * if the user wants it (the logic is in the subroutines). |
| 178 | */ |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 179 | if (of_size) { |
Kumar Gala | d2bc095 | 2008-02-27 21:51:45 -0600 | [diff] [blame] | 180 | /* pass in dummy initrd info, we'll fix up later */ |
| 181 | if (fdt_chosen(of_flat_tree, rd_data_start, rd_data_end, 0) < 0) { |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 182 | fdt_error ("/chosen node create failed"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 183 | goto error; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 184 | } |
| 185 | #ifdef CONFIG_OF_HAS_UBOOT_ENV |
| 186 | if (fdt_env(of_flat_tree) < 0) { |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 187 | fdt_error ("/u-boot-env node create failed"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 188 | goto error; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 189 | } |
| 190 | #endif |
| 191 | #ifdef CONFIG_OF_HAS_BD_T |
| 192 | if (fdt_bd_t(of_flat_tree) < 0) { |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 193 | fdt_error ("/bd_t node create failed"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 194 | goto error; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 195 | } |
| 196 | #endif |
| 197 | #ifdef CONFIG_OF_BOARD_SETUP |
| 198 | /* Call the board-specific fixup routine */ |
| 199 | ft_board_setup(of_flat_tree, gd->bd); |
| 200 | #endif |
| 201 | } |
Marian Balakowicz | 4a2ad5f | 2008-01-31 13:20:07 +0100 | [diff] [blame] | 202 | #endif /* CONFIG_OF_LIBFDT */ |
Marian Balakowicz | d45d5a1 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 203 | |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 204 | ret = boot_ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end); |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 205 | if (ret) |
| 206 | goto error; |
Kumar Gala | d2bc095 | 2008-02-27 21:51:45 -0600 | [diff] [blame] | 207 | |
| 208 | #if defined(CONFIG_OF_LIBFDT) |
| 209 | /* fixup the initrd now that we know where it should be */ |
| 210 | if ((of_flat_tree) && (initrd_start && initrd_end)) { |
| 211 | uint64_t addr, size; |
| 212 | int total = fdt_num_mem_rsv(of_flat_tree); |
| 213 | int j; |
| 214 | |
| 215 | /* Look for the dummy entry and delete it */ |
| 216 | for (j = 0; j < total; j++) { |
| 217 | fdt_get_mem_rsv(of_flat_tree, j, &addr, &size); |
| 218 | if (addr == rd_data_start) { |
| 219 | fdt_del_mem_rsv(of_flat_tree, j); |
| 220 | break; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | ret = fdt_add_mem_rsv(of_flat_tree, initrd_start, |
| 225 | initrd_end - initrd_start + 1); |
| 226 | if (ret < 0) { |
| 227 | printf("fdt_chosen: %s\n", fdt_strerror(ret)); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 228 | goto error; |
Kumar Gala | d2bc095 | 2008-02-27 21:51:45 -0600 | [diff] [blame] | 229 | } |
| 230 | |
| 231 | do_fixup_by_path_u32(of_flat_tree, "/chosen", |
| 232 | "linux,initrd-start", initrd_start, 0); |
| 233 | do_fixup_by_path_u32(of_flat_tree, "/chosen", |
| 234 | "linux,initrd-end", initrd_end, 0); |
| 235 | } |
| 236 | #endif |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 237 | debug ("## Transferring control to Linux (at address %08lx) ...\n", |
| 238 | (ulong)kernel); |
| 239 | |
| 240 | show_boot_progress (15); |
| 241 | |
| 242 | #if defined(CFG_INIT_RAM_LOCK) && !defined(CONFIG_E500) |
| 243 | unlock_ram_in_cache(); |
| 244 | #endif |
Kumar Gala | 75fa002 | 2008-02-27 21:51:51 -0600 | [diff] [blame] | 245 | if (!images->autostart) |
| 246 | return ; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 247 | |
Marian Balakowicz | 4a2ad5f | 2008-01-31 13:20:07 +0100 | [diff] [blame] | 248 | #if defined(CONFIG_OF_LIBFDT) |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 249 | if (of_flat_tree) { /* device tree; boot new style */ |
| 250 | /* |
| 251 | * Linux Kernel Parameters (passing device tree): |
| 252 | * r3: pointer to the fdt, followed by the board info data |
| 253 | * r4: physical pointer to the kernel itself |
| 254 | * r5: NULL |
| 255 | * r6: NULL |
| 256 | * r7: NULL |
| 257 | */ |
| 258 | (*kernel) ((bd_t *)of_flat_tree, (ulong)kernel, 0, 0, 0); |
| 259 | /* does not return */ |
| 260 | } |
| 261 | #endif |
| 262 | /* |
| 263 | * Linux Kernel Parameters (passing board info data): |
| 264 | * r3: ptr to board info data |
| 265 | * r4: initrd_start or 0 if no initrd |
| 266 | * r5: initrd_end - unused if r4 is 0 |
| 267 | * r6: Start of command line string |
| 268 | * r7: End of command line string |
| 269 | */ |
| 270 | (*kernel) (kbd, initrd_start, initrd_end, cmd_start, cmd_end); |
| 271 | /* does not return */ |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 272 | return ; |
| 273 | |
| 274 | error: |
Kumar Gala | 75fa002 | 2008-02-27 21:51:51 -0600 | [diff] [blame] | 275 | if (images->autostart) |
| 276 | do_reset (cmdtp, flag, argc, argv); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 277 | return ; |
Marian Balakowicz | 5d3cc55 | 2008-01-08 18:11:43 +0100 | [diff] [blame] | 278 | } |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 279 | |
Marian Balakowicz | ceaed2b | 2008-01-31 13:57:17 +0100 | [diff] [blame] | 280 | static ulong get_sp (void) |
| 281 | { |
| 282 | ulong sp; |
| 283 | |
| 284 | asm( "mr %0,1": "=r"(sp) : ); |
| 285 | return sp; |
| 286 | } |
| 287 | |
Marian Balakowicz | b6b0fe6 | 2008-01-31 13:58:13 +0100 | [diff] [blame] | 288 | static void set_clocks_in_mhz (bd_t *kbd) |
| 289 | { |
| 290 | char *s; |
| 291 | |
| 292 | if ((s = getenv ("clocks_in_mhz")) != NULL) { |
| 293 | /* convert all clock information to MHz */ |
| 294 | kbd->bi_intfreq /= 1000000L; |
| 295 | kbd->bi_busfreq /= 1000000L; |
| 296 | #if defined(CONFIG_MPC8220) |
| 297 | kbd->bi_inpfreq /= 1000000L; |
| 298 | kbd->bi_pcifreq /= 1000000L; |
| 299 | kbd->bi_pevfreq /= 1000000L; |
| 300 | kbd->bi_flbfreq /= 1000000L; |
| 301 | kbd->bi_vcofreq /= 1000000L; |
| 302 | #endif |
| 303 | #if defined(CONFIG_CPM2) |
| 304 | kbd->bi_cpmfreq /= 1000000L; |
| 305 | kbd->bi_brgfreq /= 1000000L; |
| 306 | kbd->bi_sccfreq /= 1000000L; |
| 307 | kbd->bi_vco /= 1000000L; |
| 308 | #endif |
| 309 | #if defined(CONFIG_MPC5xxx) |
| 310 | kbd->bi_ipbfreq /= 1000000L; |
| 311 | kbd->bi_pcifreq /= 1000000L; |
| 312 | #endif /* CONFIG_MPC5xxx */ |
| 313 | } |
| 314 | } |
| 315 | |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 316 | #if defined(CONFIG_OF_LIBFDT) |
| 317 | static void fdt_error (const char *msg) |
| 318 | { |
| 319 | puts ("ERROR: "); |
| 320 | puts (msg); |
| 321 | puts (" - must RESET the board to recover.\n"); |
| 322 | } |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 323 | |
Marian Balakowicz | ff0734c | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 324 | static image_header_t *image_get_fdt (ulong fdt_addr) |
| 325 | { |
| 326 | image_header_t *fdt_hdr = (image_header_t *)fdt_addr; |
| 327 | |
| 328 | image_print_contents (fdt_hdr); |
| 329 | |
| 330 | puts (" Verifying Checksum ... "); |
| 331 | if (!image_check_hcrc (fdt_hdr)) { |
| 332 | fdt_error ("fdt header checksum invalid"); |
| 333 | return NULL; |
| 334 | } |
| 335 | |
| 336 | if (!image_check_dcrc (fdt_hdr)) { |
| 337 | fdt_error ("fdt checksum invalid"); |
| 338 | return NULL; |
| 339 | } |
| 340 | puts ("OK\n"); |
| 341 | |
| 342 | if (!image_check_type (fdt_hdr, IH_TYPE_FLATDT)) { |
| 343 | fdt_error ("uImage is not a fdt"); |
| 344 | return NULL; |
| 345 | } |
| 346 | if (image_get_comp (fdt_hdr) != IH_COMP_NONE) { |
| 347 | fdt_error ("uImage is compressed"); |
| 348 | return NULL; |
| 349 | } |
| 350 | if (fdt_check_header ((char *)image_get_data (fdt_hdr)) != 0) { |
| 351 | fdt_error ("uImage data is not a fdt"); |
| 352 | return NULL; |
| 353 | } |
| 354 | return fdt_hdr; |
| 355 | } |
| 356 | |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 357 | static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 358 | bootm_headers_t *images, char **of_flat_tree, ulong *of_size) |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 359 | { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 360 | ulong fdt_addr; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 361 | image_header_t *fdt_hdr; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 362 | char *fdt_blob = NULL; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 363 | ulong image_start, image_end; |
| 364 | ulong load_start, load_end; |
| 365 | #if defined(CONFIG_FIT) |
| 366 | void *fit_hdr; |
| 367 | const char *fit_uname_config = NULL; |
| 368 | const char *fit_uname_fdt = NULL; |
| 369 | ulong default_addr; |
| 370 | #endif |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 371 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 372 | if (argc > 3) { |
| 373 | #if defined(CONFIG_FIT) |
| 374 | /* |
| 375 | * If the FDT blob comes from the FIT image and the FIT image |
| 376 | * address is omitted in the command line argument, try to use |
| 377 | * ramdisk or os FIT image address or default load address. |
| 378 | */ |
| 379 | if (images->fit_uname_rd) |
| 380 | default_addr = (ulong)images->fit_hdr_rd; |
| 381 | else if (images->fit_uname_os) |
| 382 | default_addr = (ulong)images->fit_hdr_os; |
| 383 | else |
| 384 | default_addr = load_addr; |
Marian Balakowicz | fff888a1 | 2008-02-21 17:20:19 +0100 | [diff] [blame] | 385 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 386 | if (fit_parse_conf (argv[3], default_addr, |
| 387 | &fdt_addr, &fit_uname_config)) { |
| 388 | debug ("* fdt: config '%s' from image at 0x%08lx\n", |
| 389 | fit_uname_config, fdt_addr); |
| 390 | } else if (fit_parse_subimage (argv[3], default_addr, |
| 391 | &fdt_addr, &fit_uname_fdt)) { |
| 392 | debug ("* fdt: subimage '%s' from image at 0x%08lx\n", |
| 393 | fit_uname_fdt, fdt_addr); |
| 394 | } else |
| 395 | #endif |
| 396 | { |
| 397 | fdt_addr = simple_strtoul(argv[3], NULL, 16); |
| 398 | debug ("* fdt: cmdline image address = 0x%08lx\n", |
| 399 | fdt_addr); |
| 400 | } |
| 401 | |
| 402 | debug ("## Checking for 'FDT'/'FDT image' at %08lx\n", |
| 403 | fdt_addr); |
Marian Balakowicz | fff888a1 | 2008-02-21 17:20:19 +0100 | [diff] [blame] | 404 | |
| 405 | /* copy from dataflash if needed */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 406 | fdt_addr = genimg_get_image (fdt_addr); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 407 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 408 | /* |
| 409 | * Check if there is an FDT image at the |
| 410 | * address provided in the second bootm argument |
| 411 | * check image type, for FIT images get a FIT node. |
| 412 | */ |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 413 | switch (genimg_get_format ((void *)fdt_addr)) { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 414 | case IMAGE_FORMAT_LEGACY: |
| 415 | debug ("* fdt: legacy format image\n"); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 416 | |
Marian Balakowicz | ff0734c | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 417 | /* verify fdt_addr points to a valid image header */ |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 418 | printf ("## Flattened Device Tree Legacy Image at %08lx\n", |
Marian Balakowicz | ff0734c | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 419 | fdt_addr); |
| 420 | fdt_hdr = image_get_fdt (fdt_addr); |
| 421 | if (!fdt_hdr) |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 422 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 423 | |
Marian Balakowicz | ff0734c | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 424 | /* |
| 425 | * move image data to the load address, |
| 426 | * make sure we don't overwrite initial image |
| 427 | */ |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 428 | image_start = (ulong)fdt_hdr; |
| 429 | image_end = image_get_image_end (fdt_hdr); |
| 430 | |
| 431 | load_start = image_get_load (fdt_hdr); |
| 432 | load_end = load_start + image_get_data_size (fdt_hdr); |
| 433 | |
| 434 | if ((load_start < image_end) && (load_end > image_start)) { |
| 435 | fdt_error ("fdt overwritten"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 436 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 437 | } |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 438 | memmove ((void *)image_get_load (fdt_hdr), |
Marian Balakowicz | ff0734c | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 439 | (void *)image_get_data (fdt_hdr), |
| 440 | image_get_data_size (fdt_hdr)); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 441 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 442 | fdt_blob = (char *)image_get_load (fdt_hdr); |
| 443 | break; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 444 | case IMAGE_FORMAT_FIT: |
Marian Balakowicz | 4efbe9d | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 445 | /* |
| 446 | * This case will catch both: new uImage format |
| 447 | * (libfdt based) and raw FDT blob (also libfdt |
| 448 | * based). |
| 449 | */ |
| 450 | #if defined(CONFIG_FIT) |
| 451 | /* check FDT blob vs FIT blob */ |
| 452 | if (0) { /* FIXME: call FIT format verification */ |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 453 | /* |
| 454 | * FIT image |
| 455 | */ |
| 456 | fit_hdr = (void *)fdt_addr; |
| 457 | debug ("* fdt: FIT format image\n"); |
| 458 | fit_unsupported_reset ("PPC fdt"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 459 | goto error; |
Marian Balakowicz | 4efbe9d | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 460 | } else |
| 461 | #endif |
| 462 | { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 463 | /* |
| 464 | * FDT blob |
| 465 | */ |
Marian Balakowicz | 4efbe9d | 2008-02-27 11:02:26 +0100 | [diff] [blame] | 466 | debug ("* fdt: raw FDT blob\n"); |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 467 | printf ("## Flattened Device Tree blob at %08lx\n", fdt_blob); |
| 468 | fdt_blob = (char *)fdt_addr; |
| 469 | } |
| 470 | break; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 471 | default: |
| 472 | fdt_error ("Did not find a cmdline Flattened Device Tree"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 473 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 474 | } |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 475 | |
| 476 | printf (" Booting using the fdt blob at 0x%x\n", fdt_blob); |
| 477 | |
| 478 | } else if (images->legacy_hdr_valid && |
| 479 | image_check_type (images->legacy_hdr_os, IH_TYPE_MULTI)) { |
| 480 | |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 481 | ulong fdt_data, fdt_len; |
| 482 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 483 | /* |
| 484 | * Now check if we have a legacy multi-component image, |
| 485 | * get second entry data start address and len. |
| 486 | */ |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 487 | printf ("## Flattened Device Tree from multi " |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 488 | "component Image at %08lX\n", |
| 489 | (ulong)images->legacy_hdr_os); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 490 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 491 | image_multi_getimg (images->legacy_hdr_os, 2, &fdt_data, &fdt_len); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 492 | if (fdt_len) { |
| 493 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 494 | fdt_blob = (char *)fdt_data; |
| 495 | printf (" Booting using the fdt at 0x%x\n", fdt_blob); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 496 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 497 | if (fdt_check_header (fdt_blob) != 0) { |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 498 | fdt_error ("image is not a fdt"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 499 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 500 | } |
| 501 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 502 | if (be32_to_cpu (fdt_totalsize (fdt_blob)) != fdt_len) { |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 503 | fdt_error ("fdt size != image size"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 504 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 505 | } |
| 506 | } else { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 507 | fdt_error ("Did not find a Flattened Device Tree " |
| 508 | "in a legacy multi-component image"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 509 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 510 | } |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 511 | } else { |
| 512 | debug ("## No Flattened Device Tree\n"); |
| 513 | *of_flat_tree = NULL; |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 514 | *of_size = 0; |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 515 | return 0; |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 516 | } |
| 517 | |
| 518 | *of_flat_tree = fdt_blob; |
| 519 | *of_size = be32_to_cpu (fdt_totalsize (fdt_blob)); |
| 520 | debug (" of_flat_tree at 0x%08lx size 0x%08lx\n", |
| 521 | *of_flat_tree, *of_size); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 522 | |
| 523 | return 0; |
| 524 | |
| 525 | error: |
| 526 | do_reset (cmdtp, flag, argc, argv); |
| 527 | return 1; |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 528 | } |
| 529 | |
Marian Balakowicz | 9a4daad | 2008-02-29 14:58:34 +0100 | [diff] [blame^] | 530 | static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base, |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 531 | cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
| 532 | char **of_flat_tree, ulong *of_size) |
| 533 | { |
| 534 | char *fdt_blob = *of_flat_tree; |
| 535 | ulong relocate = 0; |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 536 | ulong of_len = 0; |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 537 | |
| 538 | /* nothing to do */ |
| 539 | if (*of_size == 0) |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 540 | return 0; |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 541 | |
| 542 | if (fdt_check_header (fdt_blob) != 0) { |
| 543 | fdt_error ("image is not a fdt"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 544 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 545 | } |
| 546 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 547 | #ifndef CFG_NO_FLASH |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 548 | /* move the blob if it is in flash (set relocate) */ |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 549 | if (addr2info ((ulong)fdt_blob) != NULL) |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 550 | relocate = 1; |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 551 | #endif |
| 552 | |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 553 | /* |
| 554 | * The blob must be within CFG_BOOTMAPSZ, |
| 555 | * so we flag it to be copied if it is not. |
| 556 | */ |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 557 | if (fdt_blob >= (char *)CFG_BOOTMAPSZ) |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 558 | relocate = 1; |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 559 | |
| 560 | of_len = be32_to_cpu (fdt_totalsize (fdt)); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 561 | |
| 562 | /* move flattend device tree if needed */ |
Marian Balakowicz | d2ced9e | 2008-02-04 08:28:17 +0100 | [diff] [blame] | 563 | if (relocate) { |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 564 | int err; |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 565 | ulong of_start; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 566 | |
| 567 | /* position on a 4K boundary before the alloc_current */ |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 568 | of_start = lmb_alloc_base(lmb, of_len, 0x1000, |
| 569 | (CFG_BOOTMAPSZ + bootmap_base)); |
| 570 | |
| 571 | if (of_start == 0) { |
| 572 | puts("device tree - allocation error\n"); |
| 573 | goto error; |
| 574 | } |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 575 | |
| 576 | debug ("## device tree at 0x%08lX ... 0x%08lX (len=%ld=0x%lX)\n", |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 577 | (ulong)fdt_blob, (ulong)fdt_blob + of_len - 1, |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 578 | of_len, of_len); |
| 579 | |
| 580 | printf (" Loading Device Tree to %08lx, end %08lx ... ", |
| 581 | of_start, of_start + of_len - 1); |
| 582 | |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 583 | err = fdt_open_into (fdt_blob, (void *)of_start, of_len); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 584 | if (err != 0) { |
| 585 | fdt_error ("fdt move failed"); |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 586 | goto error; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 587 | } |
| 588 | puts ("OK\n"); |
| 589 | |
| 590 | *of_flat_tree = (char *)of_start; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 591 | } else { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 592 | *of_flat_tree = fdt_blob; |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 593 | lmb_reserve(lmb, (ulong)fdt, of_len); |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 594 | } |
| 595 | |
Kumar Gala | e822d7f | 2008-02-27 21:51:49 -0600 | [diff] [blame] | 596 | return 0; |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 597 | |
| 598 | error: |
Kumar Gala | 274cea2 | 2008-02-27 21:51:46 -0600 | [diff] [blame] | 599 | return 1; |
Marian Balakowicz | 7b32545 | 2008-01-31 13:58:20 +0100 | [diff] [blame] | 600 | } |
Marian Balakowicz | d3c5eb6 | 2008-01-31 13:20:08 +0100 | [diff] [blame] | 601 | #endif |