2 * (C) Copyright 2011 Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
4 * Based on microblaze implementation by:
5 * (C) Copyright 2007 Michal Simek
6 * (C) Copyright 2004 Atmark Techno, Inc.
8 * Michal SIMEK <monstr@monstr.eu>
9 * Yasushi SHOJI <yashi@atmark-techno.com>
11 * See file CREDITS for list of people who contributed to this
14 * This program is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU General Public License as
16 * published by the Free Software Foundation; either version 2 of
17 * the License, or (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
33 #include <u-boot/zlib.h>
34 #include <asm/byteorder.h>
36 DECLARE_GLOBAL_DATA_PTR;
38 int do_bootm_linux(int flag, int argc, char * const argv[],
39 bootm_headers_t *images)
41 void (*kernel) (unsigned int);
42 ulong rd_data_start, rd_data_end;
45 * allow the PREP bootm subcommand, it is required for bootm to work
47 if (flag & BOOTM_STATE_OS_PREP)
50 if ((flag != 0) && (flag != BOOTM_STATE_OS_GO))
55 char *of_flat_tree = NULL;
56 #if defined(CONFIG_OF_LIBFDT)
57 /* did generic code already find a device tree? */
59 of_flat_tree = images->ft_addr;
62 kernel = (void (*)(unsigned int))images->ep;
65 ret = boot_get_ramdisk(argc, argv, images, IH_ARCH_OPENRISC,
66 &rd_data_start, &rd_data_end);
70 show_boot_progress(15);
72 if (!of_flat_tree && argc > 1)
73 of_flat_tree = (char *)simple_strtoul(argv[1], NULL, 16);
75 printf("## Transferring control to Linux (at address 0x%08lx) " \
76 "ramdisk 0x%08lx, FDT 0x%08lx...\n",
77 (ulong) kernel, rd_data_start, (ulong) of_flat_tree);
79 if (dcache_status() || icache_status())
80 flush_cache((ulong)kernel, max(checkdcache(), checkicache()));
83 * Linux Kernel Parameters (passing device tree):
84 * r3: pointer to the fdt, followed by the board info data
86 kernel((unsigned int) of_flat_tree);