1157873Simp/******************************************************************************
2157873Simp *
3157873Simp * Filename: tag_list.c
4157873Simp *
5157873Simp * Instantiation of basic routines that create linux-boot tag list.
6157873Simp *
7157873Simp * Revision information:
8157873Simp *
9157873Simp * 22AUG2004	kb_admin	initial creation
10157873Simp *
11157873Simp * BEGIN_KBDD_BLOCK
12157873Simp * No warranty, expressed or implied, is included with this software.  It is
13157873Simp * provided "AS IS" and no warranty of any kind including statutory or aspects
14157873Simp * relating to merchantability or fitness for any purpose is provided.  All
15157873Simp * intellectual property rights of others is maintained with the respective
16157873Simp * owners.  This software is not copyrighted and is intended for reference
17157873Simp * only.
18157873Simp * END_BLOCK
19157873Simp *
20157873Simp * $FreeBSD$
21157873Simp *****************************************************************************/
22157873Simp
23157873Simp/******************************* GLOBALS *************************************/
24157873Simp
25157873Simp/********************** PRIVATE FUNCTIONS/DATA/DEFINES ***********************/
26157873Simp
27157873Simp#define u32 unsigned
28157873Simp#define u16 unsigned short
29157873Simp#define u8  unsigned char
30157873Simp
31157921Simp// #include "/usr/src/arm/linux/include/asm/setup.h"
32157921Simp#include <linux/asm/setup.h>
33157921Simp#include "tag_list.h"
34157873Simp
35157873Simp#define PAGE_SIZE 	0x1000
36157873Simp#define MEM_SIZE	0x2000000
37157873Simp#define PHYS_OFFSET	0x20000000
38157873Simp
39157873Simp/*************************** GLOBAL FUNCTIONS ********************************/
40157873Simp
41157873Simp/*
42157873Simp * .KB_C_FN_DEFINITION_START
43157873Simp * void InitTagList(char*, void *)
44157873Simp *  This global function populates a linux-boot style tag list from the
45157873Simp * string passed in the pointer at the location specified.
46157873Simp * .KB_C_FN_DEFINITION_END
47157873Simp */
48157873Simpvoid InitTagList(char *parms, void *output) {
49157873Simp
50157873Simp	char *src, *dst;
51157873Simp	struct tag *tagList = (struct tag*)output;
52157873Simp
53157873Simp	tagList->hdr.size  = tag_size(tag_core);
54157873Simp	tagList->hdr.tag   = ATAG_CORE;
55157873Simp	tagList->u.core.flags    = 1;
56157873Simp	tagList->u.core.pagesize = PAGE_SIZE;
57157873Simp	tagList->u.core.rootdev  = 0xff;
58157873Simp	tagList = tag_next(tagList);
59157873Simp
60157873Simp	tagList->hdr.size  = tag_size(tag_mem32);
61157873Simp	tagList->hdr.tag   = ATAG_MEM;
62157873Simp	tagList->u.mem.size  = MEM_SIZE;
63157873Simp	tagList->u.mem.start = PHYS_OFFSET;
64157873Simp	tagList = tag_next(tagList);
65157873Simp
66157873Simp	tagList->hdr.size  = tag_size(tag_cmdline);
67157873Simp	tagList->hdr.tag   = ATAG_CMDLINE;
68157873Simp
69157873Simp	src = parms;
70157873Simp	dst = tagList->u.cmdline.cmdline;
71157873Simp	while (*src) {
72157873Simp		*dst++ = *src++;
73157873Simp	}
74157873Simp	*dst = 0;
75157873Simp
76157873Simp	tagList->hdr.size += ((unsigned)(src - parms) + 1) / sizeof(unsigned);
77157873Simp	tagList = tag_next(tagList);
78157873Simp
79157873Simp	tagList->hdr.size  = 0;
80157873Simp	tagList->hdr.tag   = ATAG_NONE;
81157873Simp}
82