wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2002 |
| 3 | * Sysgo Real-Time Solutions, GmbH <www.elinos.com> |
| 4 | * Marius Groeger <mgroeger@sysgo.de> |
| 5 | * |
| 6 | * Copyright (C) 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) |
| 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 |
wdenk | 29e7f5a | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 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 |
wdenk | 29e7f5a | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 21 | * |
| 22 | */ |
| 23 | |
| 24 | #include <common.h> |
| 25 | #include <command.h> |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 26 | #include <image.h> |
| 27 | #include <zlib.h> |
| 28 | #include <asm/byteorder.h> |
| 29 | |
Wolfgang Denk | 6405a15 | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 30 | DECLARE_GLOBAL_DATA_PTR; |
| 31 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 32 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
| 33 | defined (CONFIG_CMDLINE_TAG) || \ |
| 34 | defined (CONFIG_INITRD_TAG) || \ |
wdenk | bc01dd5 | 2004-01-02 16:05:07 +0000 | [diff] [blame] | 35 | defined (CONFIG_SERIAL_TAG) || \ |
| 36 | defined (CONFIG_REVISION_TAG) || \ |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 37 | defined (CONFIG_VFD) || \ |
| 38 | defined (CONFIG_LCD) |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 39 | static void setup_start_tag (bd_t *bd); |
| 40 | |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 41 | # ifdef CONFIG_SETUP_MEMORY_TAGS |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 42 | static void setup_memory_tags (bd_t *bd); |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 43 | # endif |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 44 | static void setup_commandline_tag (bd_t *bd, char *commandline); |
| 45 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 46 | #if 0 |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 47 | static void setup_ramdisk_tag (bd_t *bd); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 48 | #endif |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 49 | # ifdef CONFIG_INITRD_TAG |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 50 | static void setup_initrd_tag (bd_t *bd, ulong initrd_start, |
| 51 | ulong initrd_end); |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 52 | # endif |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 53 | static void setup_end_tag (bd_t *bd); |
| 54 | |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 55 | # if defined (CONFIG_VFD) || defined (CONFIG_LCD) |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 56 | static void setup_videolfb_tag (gd_t *gd); |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 57 | # endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 58 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 59 | static struct tag *params; |
| 60 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ |
| 61 | |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 62 | extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]); |
| 63 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 64 | void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[], |
Marian Balakowicz | 61fde55 | 2008-02-27 11:01:04 +0100 | [diff] [blame] | 65 | bootm_headers_t *images) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 66 | { |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 67 | ulong initrd_start, initrd_end; |
| 68 | ulong ep = 0; |
| 69 | bd_t *bd = gd->bd; |
| 70 | char *s; |
| 71 | int machid = bd->bi_arch_number; |
| 72 | void (*theKernel)(int zero, int arch, uint params); |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 73 | int ret; |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 74 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 75 | #ifdef CONFIG_CMDLINE_TAG |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 76 | char *commandline = getenv ("bootargs"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 77 | #endif |
| 78 | |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 79 | /* find kernel entry point */ |
| 80 | if (images->legacy_hdr_valid) { |
Marian Balakowicz | ab00e02 | 2008-04-11 11:07:49 +0200 | [diff] [blame] | 81 | ep = image_get_ep (&images->legacy_hdr_os_copy); |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 82 | #if defined(CONFIG_FIT) |
| 83 | } else if (images->fit_uname_os) { |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 84 | ret = fit_image_get_entry (images->fit_hdr_os, |
| 85 | images->fit_noffset_os, &ep); |
| 86 | if (ret) { |
| 87 | puts ("Can't get entry point property!\n"); |
| 88 | goto error; |
| 89 | } |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 90 | #endif |
| 91 | } else { |
| 92 | puts ("Could not find kernel entry point!\n"); |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 93 | goto error; |
Marian Balakowicz | dbdd16a | 2008-02-04 08:28:09 +0100 | [diff] [blame] | 94 | } |
| 95 | theKernel = (void (*)(int, int, uint))ep; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 96 | |
Uwe Kleine-König | 533937d | 2008-01-30 09:08:49 +0100 | [diff] [blame] | 97 | s = getenv ("machid"); |
| 98 | if (s) { |
| 99 | machid = simple_strtoul (s, NULL, 16); |
| 100 | printf ("Using machid 0x%x from environment\n", machid); |
| 101 | } |
| 102 | |
Marian Balakowicz | a0ffb42 | 2008-03-12 10:14:38 +0100 | [diff] [blame] | 103 | ret = boot_get_ramdisk (argc, argv, images, IH_ARCH_ARM, |
| 104 | &initrd_start, &initrd_end); |
| 105 | if (ret) |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 106 | goto error; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 107 | |
Heiko Schocher | 8a8ec53 | 2007-07-13 09:54:17 +0200 | [diff] [blame] | 108 | show_boot_progress (15); |
wdenk | 384ae02 | 2002-11-05 00:17:55 +0000 | [diff] [blame] | 109 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 110 | debug ("## Transferring control to Linux (at address %08lx) ...\n", |
| 111 | (ulong) theKernel); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 112 | |
| 113 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
| 114 | defined (CONFIG_CMDLINE_TAG) || \ |
| 115 | defined (CONFIG_INITRD_TAG) || \ |
wdenk | bc01dd5 | 2004-01-02 16:05:07 +0000 | [diff] [blame] | 116 | defined (CONFIG_SERIAL_TAG) || \ |
| 117 | defined (CONFIG_REVISION_TAG) || \ |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 118 | defined (CONFIG_LCD) || \ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 119 | defined (CONFIG_VFD) |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 120 | setup_start_tag (bd); |
wdenk | bc01dd5 | 2004-01-02 16:05:07 +0000 | [diff] [blame] | 121 | #ifdef CONFIG_SERIAL_TAG |
| 122 | setup_serial_tag (¶ms); |
| 123 | #endif |
| 124 | #ifdef CONFIG_REVISION_TAG |
| 125 | setup_revision_tag (¶ms); |
| 126 | #endif |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 127 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 128 | setup_memory_tags (bd); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 129 | #endif |
| 130 | #ifdef CONFIG_CMDLINE_TAG |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 131 | setup_commandline_tag (bd, commandline); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 132 | #endif |
| 133 | #ifdef CONFIG_INITRD_TAG |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 134 | if (initrd_start && initrd_end) |
| 135 | setup_initrd_tag (bd, initrd_start, initrd_end); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 136 | #endif |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 137 | #if defined (CONFIG_VFD) || defined (CONFIG_LCD) |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 138 | setup_videolfb_tag ((gd_t *) gd); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 139 | #endif |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 140 | setup_end_tag (bd); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 141 | #endif |
| 142 | |
Kumar Gala | aa0826b | 2008-02-27 21:51:51 -0600 | [diff] [blame] | 143 | if (!images->autostart) |
| 144 | return ; |
| 145 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 146 | /* we assume that the kernel is in place */ |
| 147 | printf ("\nStarting kernel ...\n\n"); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 148 | |
wdenk | 29e7f5a | 2004-03-12 00:14:09 +0000 | [diff] [blame] | 149 | #ifdef CONFIG_USB_DEVICE |
| 150 | { |
| 151 | extern void udc_disconnect (void); |
| 152 | udc_disconnect (); |
| 153 | } |
| 154 | #endif |
| 155 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 156 | cleanup_before_linux (); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 157 | |
Uwe Kleine-König | 533937d | 2008-01-30 09:08:49 +0100 | [diff] [blame] | 158 | theKernel (0, machid, bd->bi_boot_params); |
Marian Balakowicz | df8ff33 | 2008-03-12 10:33:00 +0100 | [diff] [blame] | 159 | /* does not return */ |
| 160 | return; |
| 161 | |
| 162 | error: |
| 163 | if (images->autostart) |
| 164 | do_reset (cmdtp, flag, argc, argv); |
| 165 | return; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 166 | } |
| 167 | |
| 168 | |
| 169 | #if defined (CONFIG_SETUP_MEMORY_TAGS) || \ |
| 170 | defined (CONFIG_CMDLINE_TAG) || \ |
| 171 | defined (CONFIG_INITRD_TAG) || \ |
wdenk | bc01dd5 | 2004-01-02 16:05:07 +0000 | [diff] [blame] | 172 | defined (CONFIG_SERIAL_TAG) || \ |
| 173 | defined (CONFIG_REVISION_TAG) || \ |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 174 | defined (CONFIG_LCD) || \ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 175 | defined (CONFIG_VFD) |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 176 | static void setup_start_tag (bd_t *bd) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 177 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 178 | params = (struct tag *) bd->bi_boot_params; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 179 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 180 | params->hdr.tag = ATAG_CORE; |
| 181 | params->hdr.size = tag_size (tag_core); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 182 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 183 | params->u.core.flags = 0; |
| 184 | params->u.core.pagesize = 0; |
| 185 | params->u.core.rootdev = 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 186 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 187 | params = tag_next (params); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 191 | #ifdef CONFIG_SETUP_MEMORY_TAGS |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 192 | static void setup_memory_tags (bd_t *bd) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 193 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 194 | int i; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 195 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 196 | for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { |
| 197 | params->hdr.tag = ATAG_MEM; |
| 198 | params->hdr.size = tag_size (tag_mem32); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 199 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 200 | params->u.mem.start = bd->bi_dram[i].start; |
| 201 | params->u.mem.size = bd->bi_dram[i].size; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 202 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 203 | params = tag_next (params); |
| 204 | } |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 205 | } |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 206 | #endif /* CONFIG_SETUP_MEMORY_TAGS */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 207 | |
| 208 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 209 | static void setup_commandline_tag (bd_t *bd, char *commandline) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 210 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 211 | char *p; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 212 | |
wdenk | f16b516 | 2004-03-23 21:43:07 +0000 | [diff] [blame] | 213 | if (!commandline) |
| 214 | return; |
| 215 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 216 | /* eat leading white space */ |
| 217 | for (p = commandline; *p == ' '; p++); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 218 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 219 | /* skip non-existent command lines so the kernel will still |
| 220 | * use its default command line. |
| 221 | */ |
| 222 | if (*p == '\0') |
| 223 | return; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 224 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 225 | params->hdr.tag = ATAG_CMDLINE; |
| 226 | params->hdr.size = |
| 227 | (sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 228 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 229 | strcpy (params->u.cmdline.cmdline, p); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 230 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 231 | params = tag_next (params); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 232 | } |
| 233 | |
| 234 | |
wdenk | 699b13a | 2002-11-03 18:03:52 +0000 | [diff] [blame] | 235 | #ifdef CONFIG_INITRD_TAG |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 236 | static void setup_initrd_tag (bd_t *bd, ulong initrd_start, ulong initrd_end) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 237 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 238 | /* an ATAG_INITRD node tells the kernel where the compressed |
| 239 | * ramdisk can be found. ATAG_RDIMG is a better name, actually. |
| 240 | */ |
wdenk | 19c8fb7 | 2004-04-18 22:26:17 +0000 | [diff] [blame] | 241 | params->hdr.tag = ATAG_INITRD2; |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 242 | params->hdr.size = tag_size (tag_initrd); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 243 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 244 | params->u.initrd.start = initrd_start; |
| 245 | params->u.initrd.size = initrd_end - initrd_start; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 246 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 247 | params = tag_next (params); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 248 | } |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 249 | #endif /* CONFIG_INITRD_TAG */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 250 | |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 251 | |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 252 | #if defined (CONFIG_VFD) || defined (CONFIG_LCD) |
| 253 | extern ulong calc_fbsize (void); |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 254 | static void setup_videolfb_tag (gd_t *gd) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 255 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 256 | /* An ATAG_VIDEOLFB node tells the kernel where and how large |
| 257 | * the framebuffer for video was allocated (among other things). |
| 258 | * Note that a _physical_ address is passed ! |
| 259 | * |
| 260 | * We only use it to pass the address and size, the other entries |
| 261 | * in the tag_videolfb are not of interest. |
| 262 | */ |
| 263 | params->hdr.tag = ATAG_VIDEOLFB; |
| 264 | params->hdr.size = tag_size (tag_videolfb); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 265 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 266 | params->u.videolfb.lfb_base = (u32) gd->fb_base; |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 267 | /* Fb size is calculated according to parameters for our panel |
| 268 | */ |
| 269 | params->u.videolfb.lfb_size = calc_fbsize(); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 270 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 271 | params = tag_next (params); |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 272 | } |
wdenk | 9ca7bbc | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 273 | #endif /* CONFIG_VFD || CONFIG_LCD */ |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 274 | |
wdenk | a21ad7b | 2005-05-19 22:39:42 +0000 | [diff] [blame] | 275 | #ifdef CONFIG_SERIAL_TAG |
| 276 | void setup_serial_tag (struct tag **tmp) |
| 277 | { |
| 278 | struct tag *params = *tmp; |
| 279 | struct tag_serialnr serialnr; |
| 280 | void get_board_serial(struct tag_serialnr *serialnr); |
| 281 | |
| 282 | get_board_serial(&serialnr); |
| 283 | params->hdr.tag = ATAG_SERIAL; |
| 284 | params->hdr.size = tag_size (tag_serialnr); |
| 285 | params->u.serialnr.low = serialnr.low; |
| 286 | params->u.serialnr.high= serialnr.high; |
| 287 | params = tag_next (params); |
| 288 | *tmp = params; |
| 289 | } |
| 290 | #endif |
| 291 | |
wdenk | cb99da5 | 2005-01-12 00:15:14 +0000 | [diff] [blame] | 292 | #ifdef CONFIG_REVISION_TAG |
| 293 | void setup_revision_tag(struct tag **in_params) |
| 294 | { |
| 295 | u32 rev = 0; |
wdenk | cb99da5 | 2005-01-12 00:15:14 +0000 | [diff] [blame] | 296 | u32 get_board_rev(void); |
| 297 | |
| 298 | rev = get_board_rev(); |
wdenk | cb99da5 | 2005-01-12 00:15:14 +0000 | [diff] [blame] | 299 | params->hdr.tag = ATAG_REVISION; |
| 300 | params->hdr.size = tag_size (tag_revision); |
| 301 | params->u.revision.rev = rev; |
| 302 | params = tag_next (params); |
| 303 | } |
| 304 | #endif /* CONFIG_REVISION_TAG */ |
| 305 | |
| 306 | |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 307 | static void setup_end_tag (bd_t *bd) |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 308 | { |
wdenk | 8676590 | 2003-12-06 23:55:10 +0000 | [diff] [blame] | 309 | params->hdr.tag = ATAG_NONE; |
| 310 | params->hdr.size = 0; |
wdenk | c609719 | 2002-11-03 00:24:07 +0000 | [diff] [blame] | 311 | } |
| 312 | |
| 313 | #endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */ |