Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2003 |
| 3 | * Wolfgang Denk, DENX Software Engineering, wd@denx.de. |
| 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 modify |
| 9 | * it under the terms of the GNU General Public License as published by |
| 10 | * the Free Software Foundation; either version 2 of the License, or |
| 11 | * (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, MA 02111-1307 USA |
| 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <command.h> |
| 26 | #include <asm/byteorder.h> |
| 27 | |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 28 | /* The SH kernel reads arguments from the empty zero page at location |
Wolfgang Denk | 61fb15c5 | 2007-12-27 01:52:50 +0100 | [diff] [blame] | 29 | * 0 at the start of SDRAM. The following are copied from |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 30 | * arch/sh/kernel/setup.c and may require tweaking if the kernel sources |
| 31 | * change. |
| 32 | */ |
Wolfgang Denk | 438a4c1 | 2008-03-26 11:48:46 +0100 | [diff] [blame] | 33 | #define PARAM ((unsigned char *)CFG_SDRAM_BASE + 0x1000) |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 34 | |
| 35 | #define MOUNT_ROOT_RDONLY (*(unsigned long *) (PARAM+0x000)) |
| 36 | #define RAMDISK_FLAGS (*(unsigned long *) (PARAM+0x004)) |
| 37 | #define ORIG_ROOT_DEV (*(unsigned long *) (PARAM+0x008)) |
| 38 | #define LOADER_TYPE (*(unsigned long *) (PARAM+0x00c)) |
| 39 | #define INITRD_START (*(unsigned long *) (PARAM+0x010)) |
| 40 | #define INITRD_SIZE (*(unsigned long *) (PARAM+0x014)) |
| 41 | /* ... */ |
| 42 | #define COMMAND_LINE ((char *) (PARAM+0x100)) |
| 43 | |
Wolfgang Denk | 438a4c1 | 2008-03-26 11:48:46 +0100 | [diff] [blame] | 44 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 45 | |
| 46 | #ifdef CFG_DEBUG |
| 47 | static void hexdump (unsigned char *buf, int len) |
| 48 | { |
| 49 | int i; |
| 50 | |
| 51 | for (i = 0; i < len; i++) { |
| 52 | if ((i % 16) == 0) |
| 53 | printf ("%s%08x: ", i ? "\n" : "", (unsigned int) &buf[i]); |
| 54 | printf ("%02x ", buf[i]); |
| 55 | } |
| 56 | printf ("\n"); |
| 57 | } |
| 58 | #endif |
| 59 | |
Kumar Gala | 40d7e99 | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 60 | int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images) |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 61 | { |
Marian Balakowicz | d5934ad | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 62 | char *bootargs = getenv("bootargs"); |
| 63 | |
Kumar Gala | c160a95 | 2008-08-15 08:24:36 -0500 | [diff] [blame] | 64 | void (*kernel) (void) = (void (*)(void))images->ep; |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 65 | |
| 66 | /* Setup parameters */ |
| 67 | memset(PARAM, 0, 0x1000); /* Clear zero page */ |
| 68 | strcpy(COMMAND_LINE, bootargs); |
Nobuhiro Iwamatsu | b02bad1 | 2007-09-23 02:12:30 +0900 | [diff] [blame] | 69 | |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 70 | kernel(); |
Marian Balakowicz | cd7c596 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 71 | /* does not return */ |
Marian Balakowicz | cd7c596 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 72 | |
| 73 | error: |
Kumar Gala | 40d7e99 | 2008-08-15 08:24:45 -0500 | [diff] [blame] | 74 | return 1; |
Nobuhiro Iwamatsu | 0b135cf | 2007-05-13 20:58:00 +0900 | [diff] [blame] | 75 | } |