blob: 62185f047dcbc466581341a58b84796dd44b088e [file] [log] [blame]
wdenkc6097192002-11-03 00:24:07 +00001/*
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
wdenk29e7f5a2004-03-12 00:14:09 +000015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
wdenkc6097192002-11-03 00:24:07 +000016 * 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
wdenk29e7f5a2004-03-12 00:14:09 +000020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
wdenkc6097192002-11-03 00:24:07 +000021 *
22 */
23
24#include <common.h>
25#include <command.h>
wdenkc6097192002-11-03 00:24:07 +000026#include <image.h>
27#include <zlib.h>
28#include <asm/byteorder.h>
wdenk381669a2003-06-16 23:50:08 +000029#ifdef CONFIG_HAS_DATAFLASH
30#include <dataflash.h>
31#endif
wdenkc6097192002-11-03 00:24:07 +000032
Wolfgang Denk6405a152006-03-31 18:32:53 +020033DECLARE_GLOBAL_DATA_PTR;
34
wdenk57b2d802003-06-27 21:31:46 +000035/*cmd_boot.c*/
36extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
37
wdenkc6097192002-11-03 00:24:07 +000038#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
39 defined (CONFIG_CMDLINE_TAG) || \
40 defined (CONFIG_INITRD_TAG) || \
wdenkbc01dd52004-01-02 16:05:07 +000041 defined (CONFIG_SERIAL_TAG) || \
42 defined (CONFIG_REVISION_TAG) || \
wdenk9ca7bbc2004-10-09 23:25:58 +000043 defined (CONFIG_VFD) || \
44 defined (CONFIG_LCD)
wdenk86765902003-12-06 23:55:10 +000045static void setup_start_tag (bd_t *bd);
46
wdenk699b13a2002-11-03 18:03:52 +000047# ifdef CONFIG_SETUP_MEMORY_TAGS
wdenk86765902003-12-06 23:55:10 +000048static void setup_memory_tags (bd_t *bd);
wdenk699b13a2002-11-03 18:03:52 +000049# endif
wdenk86765902003-12-06 23:55:10 +000050static void setup_commandline_tag (bd_t *bd, char *commandline);
51
wdenkc6097192002-11-03 00:24:07 +000052#if 0
wdenk86765902003-12-06 23:55:10 +000053static void setup_ramdisk_tag (bd_t *bd);
wdenkc6097192002-11-03 00:24:07 +000054#endif
wdenk699b13a2002-11-03 18:03:52 +000055# ifdef CONFIG_INITRD_TAG
wdenk86765902003-12-06 23:55:10 +000056static void setup_initrd_tag (bd_t *bd, ulong initrd_start,
57 ulong initrd_end);
wdenk699b13a2002-11-03 18:03:52 +000058# endif
wdenk86765902003-12-06 23:55:10 +000059static void setup_end_tag (bd_t *bd);
60
wdenk9ca7bbc2004-10-09 23:25:58 +000061# if defined (CONFIG_VFD) || defined (CONFIG_LCD)
wdenk86765902003-12-06 23:55:10 +000062static void setup_videolfb_tag (gd_t *gd);
wdenk699b13a2002-11-03 18:03:52 +000063# endif
wdenkc6097192002-11-03 00:24:07 +000064
65
66static struct tag *params;
67#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */
68
wdenk86765902003-12-06 23:55:10 +000069extern image_header_t header; /* from cmd_bootm.c */
wdenkc6097192002-11-03 00:24:07 +000070
71
wdenk86765902003-12-06 23:55:10 +000072void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
73 ulong addr, ulong *len_ptr, int verify)
wdenkc6097192002-11-03 00:24:07 +000074{
wdenk86765902003-12-06 23:55:10 +000075 ulong len = 0, checksum;
76 ulong initrd_start, initrd_end;
77 ulong data;
wdenk4ea537d2003-12-07 18:32:37 +000078 void (*theKernel)(int zero, int arch, uint params);
wdenk86765902003-12-06 23:55:10 +000079 image_header_t *hdr = &header;
80 bd_t *bd = gd->bd;
Uwe Kleine-König533937d2008-01-30 09:08:49 +010081 int machid = bd->bi_arch_number;
82 char *s;
wdenk86765902003-12-06 23:55:10 +000083
wdenkc6097192002-11-03 00:24:07 +000084#ifdef CONFIG_CMDLINE_TAG
wdenk86765902003-12-06 23:55:10 +000085 char *commandline = getenv ("bootargs");
wdenkc6097192002-11-03 00:24:07 +000086#endif
87
wdenk4ea537d2003-12-07 18:32:37 +000088 theKernel = (void (*)(int, int, uint))ntohl(hdr->ih_ep);
wdenkc6097192002-11-03 00:24:07 +000089
Uwe Kleine-König533937d2008-01-30 09:08:49 +010090 s = getenv ("machid");
91 if (s) {
92 machid = simple_strtoul (s, NULL, 16);
93 printf ("Using machid 0x%x from environment\n", machid);
94 }
95
wdenk86765902003-12-06 23:55:10 +000096 /*
97 * Check if there is an initrd image
98 */
99 if (argc >= 3) {
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200100 show_boot_progress (9);
wdenk384ae022002-11-05 00:17:55 +0000101
wdenk86765902003-12-06 23:55:10 +0000102 addr = simple_strtoul (argv[2], NULL, 16);
wdenkc6097192002-11-03 00:24:07 +0000103
wdenk86765902003-12-06 23:55:10 +0000104 printf ("## Loading Ramdisk Image at %08lx ...\n", addr);
wdenkc6097192002-11-03 00:24:07 +0000105
wdenk86765902003-12-06 23:55:10 +0000106 /* Copy header so we can blank CRC field for re-calculation */
wdenk381669a2003-06-16 23:50:08 +0000107#ifdef CONFIG_HAS_DATAFLASH
wdenk86765902003-12-06 23:55:10 +0000108 if (addr_dataflash (addr)) {
109 read_dataflash (addr, sizeof (image_header_t),
110 (char *) &header);
111 } else
wdenk57b2d802003-06-27 21:31:46 +0000112#endif
wdenk86765902003-12-06 23:55:10 +0000113 memcpy (&header, (char *) addr,
114 sizeof (image_header_t));
wdenkc6097192002-11-03 00:24:07 +0000115
wdenk86765902003-12-06 23:55:10 +0000116 if (ntohl (hdr->ih_magic) != IH_MAGIC) {
117 printf ("Bad Magic Number\n");
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200118 show_boot_progress (-10);
wdenk86765902003-12-06 23:55:10 +0000119 do_reset (cmdtp, flag, argc, argv);
120 }
wdenkc6097192002-11-03 00:24:07 +0000121
wdenk86765902003-12-06 23:55:10 +0000122 data = (ulong) & header;
123 len = sizeof (image_header_t);
wdenkc6097192002-11-03 00:24:07 +0000124
wdenk86765902003-12-06 23:55:10 +0000125 checksum = ntohl (hdr->ih_hcrc);
126 hdr->ih_hcrc = 0;
wdenkc6097192002-11-03 00:24:07 +0000127
Wolfgang Denk7fa6e902006-03-11 22:53:33 +0100128 if (crc32 (0, (unsigned char *) data, len) != checksum) {
wdenk86765902003-12-06 23:55:10 +0000129 printf ("Bad Header Checksum\n");
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200130 show_boot_progress (-11);
wdenk86765902003-12-06 23:55:10 +0000131 do_reset (cmdtp, flag, argc, argv);
132 }
wdenkc6097192002-11-03 00:24:07 +0000133
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200134 show_boot_progress (10);
wdenk384ae022002-11-05 00:17:55 +0000135
wdenk86765902003-12-06 23:55:10 +0000136 print_image_hdr (hdr);
wdenkc6097192002-11-03 00:24:07 +0000137
wdenk86765902003-12-06 23:55:10 +0000138 data = addr + sizeof (image_header_t);
139 len = ntohl (hdr->ih_size);
wdenkc6097192002-11-03 00:24:07 +0000140
wdenk381669a2003-06-16 23:50:08 +0000141#ifdef CONFIG_HAS_DATAFLASH
wdenk86765902003-12-06 23:55:10 +0000142 if (addr_dataflash (addr)) {
143 read_dataflash (data, len, (char *) CFG_LOAD_ADDR);
144 data = CFG_LOAD_ADDR;
145 }
wdenk381669a2003-06-16 23:50:08 +0000146#endif
147
wdenk86765902003-12-06 23:55:10 +0000148 if (verify) {
149 ulong csum = 0;
wdenkc6097192002-11-03 00:24:07 +0000150
wdenk86765902003-12-06 23:55:10 +0000151 printf (" Verifying Checksum ... ");
Wolfgang Denk7fa6e902006-03-11 22:53:33 +0100152 csum = crc32 (0, (unsigned char *) data, len);
wdenk86765902003-12-06 23:55:10 +0000153 if (csum != ntohl (hdr->ih_dcrc)) {
154 printf ("Bad Data CRC\n");
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200155 show_boot_progress (-12);
wdenk86765902003-12-06 23:55:10 +0000156 do_reset (cmdtp, flag, argc, argv);
157 }
158 printf ("OK\n");
159 }
wdenkc6097192002-11-03 00:24:07 +0000160
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200161 show_boot_progress (11);
wdenk384ae022002-11-05 00:17:55 +0000162
wdenk86765902003-12-06 23:55:10 +0000163 if ((hdr->ih_os != IH_OS_LINUX) ||
164 (hdr->ih_arch != IH_CPU_ARM) ||
165 (hdr->ih_type != IH_TYPE_RAMDISK)) {
166 printf ("No Linux ARM Ramdisk Image\n");
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200167 show_boot_progress (-13);
wdenk86765902003-12-06 23:55:10 +0000168 do_reset (cmdtp, flag, argc, argv);
169 }
wdenkc6097192002-11-03 00:24:07 +0000170
Wolfgang Denk4dc11462005-09-26 01:06:33 +0200171#if defined(CONFIG_B2) || defined(CONFIG_EVB4510) || defined(CONFIG_ARMADILLO)
wdenkb98ac282004-02-24 00:16:43 +0000172 /*
173 *we need to copy the ramdisk to SRAM to let Linux boot
174 */
175 memmove ((void *) ntohl(hdr->ih_load), (uchar *)data, len);
176 data = ntohl(hdr->ih_load);
wdenk82db02f2004-07-11 22:19:26 +0000177#endif /* CONFIG_B2 || CONFIG_EVB4510 */
wdenkb98ac282004-02-24 00:16:43 +0000178
wdenk86765902003-12-06 23:55:10 +0000179 /*
180 * Now check if we have a multifile image
181 */
182 } else if ((hdr->ih_type == IH_TYPE_MULTI) && (len_ptr[1])) {
183 ulong tail = ntohl (len_ptr[0]) % 4;
184 int i;
wdenkc6097192002-11-03 00:24:07 +0000185
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200186 show_boot_progress (13);
wdenk384ae022002-11-05 00:17:55 +0000187
wdenk86765902003-12-06 23:55:10 +0000188 /* skip kernel length and terminator */
189 data = (ulong) (&len_ptr[2]);
190 /* skip any additional image length fields */
191 for (i = 1; len_ptr[i]; ++i)
192 data += 4;
193 /* add kernel length, and align */
194 data += ntohl (len_ptr[0]);
195 if (tail) {
196 data += 4 - tail;
197 }
wdenkc6097192002-11-03 00:24:07 +0000198
wdenk86765902003-12-06 23:55:10 +0000199 len = ntohl (len_ptr[1]);
wdenkc6097192002-11-03 00:24:07 +0000200
wdenk86765902003-12-06 23:55:10 +0000201 } else {
202 /*
203 * no initrd image
204 */
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200205 show_boot_progress (14);
wdenk384ae022002-11-05 00:17:55 +0000206
wdenk86765902003-12-06 23:55:10 +0000207 len = data = 0;
208 }
wdenkc6097192002-11-03 00:24:07 +0000209
210#ifdef DEBUG
wdenk86765902003-12-06 23:55:10 +0000211 if (!data) {
212 printf ("No initrd\n");
213 }
wdenkc6097192002-11-03 00:24:07 +0000214#endif
215
wdenk86765902003-12-06 23:55:10 +0000216 if (data) {
217 initrd_start = data;
218 initrd_end = initrd_start + len;
219 } else {
220 initrd_start = 0;
221 initrd_end = 0;
222 }
wdenkc6097192002-11-03 00:24:07 +0000223
Heiko Schocher8a8ec532007-07-13 09:54:17 +0200224 show_boot_progress (15);
wdenk384ae022002-11-05 00:17:55 +0000225
wdenk86765902003-12-06 23:55:10 +0000226 debug ("## Transferring control to Linux (at address %08lx) ...\n",
227 (ulong) theKernel);
wdenkc6097192002-11-03 00:24:07 +0000228
229#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
230 defined (CONFIG_CMDLINE_TAG) || \
231 defined (CONFIG_INITRD_TAG) || \
wdenkbc01dd52004-01-02 16:05:07 +0000232 defined (CONFIG_SERIAL_TAG) || \
233 defined (CONFIG_REVISION_TAG) || \
wdenk9ca7bbc2004-10-09 23:25:58 +0000234 defined (CONFIG_LCD) || \
wdenkc6097192002-11-03 00:24:07 +0000235 defined (CONFIG_VFD)
wdenk86765902003-12-06 23:55:10 +0000236 setup_start_tag (bd);
wdenkbc01dd52004-01-02 16:05:07 +0000237#ifdef CONFIG_SERIAL_TAG
238 setup_serial_tag (&params);
239#endif
240#ifdef CONFIG_REVISION_TAG
241 setup_revision_tag (&params);
242#endif
wdenkc6097192002-11-03 00:24:07 +0000243#ifdef CONFIG_SETUP_MEMORY_TAGS
wdenk86765902003-12-06 23:55:10 +0000244 setup_memory_tags (bd);
wdenkc6097192002-11-03 00:24:07 +0000245#endif
246#ifdef CONFIG_CMDLINE_TAG
wdenk86765902003-12-06 23:55:10 +0000247 setup_commandline_tag (bd, commandline);
wdenkc6097192002-11-03 00:24:07 +0000248#endif
249#ifdef CONFIG_INITRD_TAG
wdenk86765902003-12-06 23:55:10 +0000250 if (initrd_start && initrd_end)
251 setup_initrd_tag (bd, initrd_start, initrd_end);
wdenkc6097192002-11-03 00:24:07 +0000252#endif
wdenk9ca7bbc2004-10-09 23:25:58 +0000253#if defined (CONFIG_VFD) || defined (CONFIG_LCD)
wdenk86765902003-12-06 23:55:10 +0000254 setup_videolfb_tag ((gd_t *) gd);
wdenkc6097192002-11-03 00:24:07 +0000255#endif
wdenk86765902003-12-06 23:55:10 +0000256 setup_end_tag (bd);
wdenkc6097192002-11-03 00:24:07 +0000257#endif
258
wdenk86765902003-12-06 23:55:10 +0000259 /* we assume that the kernel is in place */
260 printf ("\nStarting kernel ...\n\n");
wdenkc6097192002-11-03 00:24:07 +0000261
wdenk29e7f5a2004-03-12 00:14:09 +0000262#ifdef CONFIG_USB_DEVICE
263 {
264 extern void udc_disconnect (void);
265 udc_disconnect ();
266 }
267#endif
268
wdenk86765902003-12-06 23:55:10 +0000269 cleanup_before_linux ();
wdenkc6097192002-11-03 00:24:07 +0000270
Uwe Kleine-König533937d2008-01-30 09:08:49 +0100271 theKernel (0, machid, bd->bi_boot_params);
wdenkc6097192002-11-03 00:24:07 +0000272}
273
274
275#if defined (CONFIG_SETUP_MEMORY_TAGS) || \
276 defined (CONFIG_CMDLINE_TAG) || \
277 defined (CONFIG_INITRD_TAG) || \
wdenkbc01dd52004-01-02 16:05:07 +0000278 defined (CONFIG_SERIAL_TAG) || \
279 defined (CONFIG_REVISION_TAG) || \
wdenk9ca7bbc2004-10-09 23:25:58 +0000280 defined (CONFIG_LCD) || \
wdenkc6097192002-11-03 00:24:07 +0000281 defined (CONFIG_VFD)
wdenk86765902003-12-06 23:55:10 +0000282static void setup_start_tag (bd_t *bd)
wdenkc6097192002-11-03 00:24:07 +0000283{
wdenk86765902003-12-06 23:55:10 +0000284 params = (struct tag *) bd->bi_boot_params;
wdenkc6097192002-11-03 00:24:07 +0000285
wdenk86765902003-12-06 23:55:10 +0000286 params->hdr.tag = ATAG_CORE;
287 params->hdr.size = tag_size (tag_core);
wdenkc6097192002-11-03 00:24:07 +0000288
wdenk86765902003-12-06 23:55:10 +0000289 params->u.core.flags = 0;
290 params->u.core.pagesize = 0;
291 params->u.core.rootdev = 0;
wdenkc6097192002-11-03 00:24:07 +0000292
wdenk86765902003-12-06 23:55:10 +0000293 params = tag_next (params);
wdenkc6097192002-11-03 00:24:07 +0000294}
295
296
wdenk699b13a2002-11-03 18:03:52 +0000297#ifdef CONFIG_SETUP_MEMORY_TAGS
wdenk86765902003-12-06 23:55:10 +0000298static void setup_memory_tags (bd_t *bd)
wdenkc6097192002-11-03 00:24:07 +0000299{
wdenk86765902003-12-06 23:55:10 +0000300 int i;
wdenkc6097192002-11-03 00:24:07 +0000301
wdenk86765902003-12-06 23:55:10 +0000302 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
303 params->hdr.tag = ATAG_MEM;
304 params->hdr.size = tag_size (tag_mem32);
wdenkc6097192002-11-03 00:24:07 +0000305
wdenk86765902003-12-06 23:55:10 +0000306 params->u.mem.start = bd->bi_dram[i].start;
307 params->u.mem.size = bd->bi_dram[i].size;
wdenkc6097192002-11-03 00:24:07 +0000308
wdenk86765902003-12-06 23:55:10 +0000309 params = tag_next (params);
310 }
wdenkc6097192002-11-03 00:24:07 +0000311}
wdenk86765902003-12-06 23:55:10 +0000312#endif /* CONFIG_SETUP_MEMORY_TAGS */
wdenkc6097192002-11-03 00:24:07 +0000313
314
wdenk86765902003-12-06 23:55:10 +0000315static void setup_commandline_tag (bd_t *bd, char *commandline)
wdenkc6097192002-11-03 00:24:07 +0000316{
wdenk86765902003-12-06 23:55:10 +0000317 char *p;
wdenkc6097192002-11-03 00:24:07 +0000318
wdenkf16b5162004-03-23 21:43:07 +0000319 if (!commandline)
320 return;
321
wdenk86765902003-12-06 23:55:10 +0000322 /* eat leading white space */
323 for (p = commandline; *p == ' '; p++);
wdenkc6097192002-11-03 00:24:07 +0000324
wdenk86765902003-12-06 23:55:10 +0000325 /* skip non-existent command lines so the kernel will still
326 * use its default command line.
327 */
328 if (*p == '\0')
329 return;
wdenkc6097192002-11-03 00:24:07 +0000330
wdenk86765902003-12-06 23:55:10 +0000331 params->hdr.tag = ATAG_CMDLINE;
332 params->hdr.size =
333 (sizeof (struct tag_header) + strlen (p) + 1 + 4) >> 2;
wdenkc6097192002-11-03 00:24:07 +0000334
wdenk86765902003-12-06 23:55:10 +0000335 strcpy (params->u.cmdline.cmdline, p);
wdenkc6097192002-11-03 00:24:07 +0000336
wdenk86765902003-12-06 23:55:10 +0000337 params = tag_next (params);
wdenkc6097192002-11-03 00:24:07 +0000338}
339
340
wdenk699b13a2002-11-03 18:03:52 +0000341#ifdef CONFIG_INITRD_TAG
wdenk86765902003-12-06 23:55:10 +0000342static void setup_initrd_tag (bd_t *bd, ulong initrd_start, ulong initrd_end)
wdenkc6097192002-11-03 00:24:07 +0000343{
wdenk86765902003-12-06 23:55:10 +0000344 /* an ATAG_INITRD node tells the kernel where the compressed
345 * ramdisk can be found. ATAG_RDIMG is a better name, actually.
346 */
wdenk19c8fb72004-04-18 22:26:17 +0000347 params->hdr.tag = ATAG_INITRD2;
wdenk86765902003-12-06 23:55:10 +0000348 params->hdr.size = tag_size (tag_initrd);
wdenkc6097192002-11-03 00:24:07 +0000349
wdenk86765902003-12-06 23:55:10 +0000350 params->u.initrd.start = initrd_start;
351 params->u.initrd.size = initrd_end - initrd_start;
wdenkc6097192002-11-03 00:24:07 +0000352
wdenk86765902003-12-06 23:55:10 +0000353 params = tag_next (params);
wdenkc6097192002-11-03 00:24:07 +0000354}
wdenk86765902003-12-06 23:55:10 +0000355#endif /* CONFIG_INITRD_TAG */
wdenkc6097192002-11-03 00:24:07 +0000356
wdenkc6097192002-11-03 00:24:07 +0000357
wdenk9ca7bbc2004-10-09 23:25:58 +0000358#if defined (CONFIG_VFD) || defined (CONFIG_LCD)
359extern ulong calc_fbsize (void);
wdenk86765902003-12-06 23:55:10 +0000360static void setup_videolfb_tag (gd_t *gd)
wdenkc6097192002-11-03 00:24:07 +0000361{
wdenk86765902003-12-06 23:55:10 +0000362 /* An ATAG_VIDEOLFB node tells the kernel where and how large
363 * the framebuffer for video was allocated (among other things).
364 * Note that a _physical_ address is passed !
365 *
366 * We only use it to pass the address and size, the other entries
367 * in the tag_videolfb are not of interest.
368 */
369 params->hdr.tag = ATAG_VIDEOLFB;
370 params->hdr.size = tag_size (tag_videolfb);
wdenkc6097192002-11-03 00:24:07 +0000371
wdenk86765902003-12-06 23:55:10 +0000372 params->u.videolfb.lfb_base = (u32) gd->fb_base;
wdenk9ca7bbc2004-10-09 23:25:58 +0000373 /* Fb size is calculated according to parameters for our panel
374 */
375 params->u.videolfb.lfb_size = calc_fbsize();
wdenkc6097192002-11-03 00:24:07 +0000376
wdenk86765902003-12-06 23:55:10 +0000377 params = tag_next (params);
wdenkc6097192002-11-03 00:24:07 +0000378}
wdenk9ca7bbc2004-10-09 23:25:58 +0000379#endif /* CONFIG_VFD || CONFIG_LCD */
wdenkc6097192002-11-03 00:24:07 +0000380
wdenka21ad7b2005-05-19 22:39:42 +0000381#ifdef CONFIG_SERIAL_TAG
382void setup_serial_tag (struct tag **tmp)
383{
384 struct tag *params = *tmp;
385 struct tag_serialnr serialnr;
386 void get_board_serial(struct tag_serialnr *serialnr);
387
388 get_board_serial(&serialnr);
389 params->hdr.tag = ATAG_SERIAL;
390 params->hdr.size = tag_size (tag_serialnr);
391 params->u.serialnr.low = serialnr.low;
392 params->u.serialnr.high= serialnr.high;
393 params = tag_next (params);
394 *tmp = params;
395}
396#endif
397
wdenkcb99da52005-01-12 00:15:14 +0000398#ifdef CONFIG_REVISION_TAG
399void setup_revision_tag(struct tag **in_params)
400{
401 u32 rev = 0;
wdenkcb99da52005-01-12 00:15:14 +0000402 u32 get_board_rev(void);
403
404 rev = get_board_rev();
wdenkcb99da52005-01-12 00:15:14 +0000405 params->hdr.tag = ATAG_REVISION;
406 params->hdr.size = tag_size (tag_revision);
407 params->u.revision.rev = rev;
408 params = tag_next (params);
409}
410#endif /* CONFIG_REVISION_TAG */
411
412
wdenk86765902003-12-06 23:55:10 +0000413static void setup_end_tag (bd_t *bd)
wdenkc6097192002-11-03 00:24:07 +0000414{
wdenk86765902003-12-06 23:55:10 +0000415 params->hdr.tag = ATAG_NONE;
416 params->hdr.size = 0;
wdenkc6097192002-11-03 00:24:07 +0000417}
418
419#endif /* CONFIG_SETUP_MEMORY_TAGS || CONFIG_CMDLINE_TAG || CONFIG_INITRD_TAG */