]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/boot/arm/at91/libat91/tag_list.c
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / sys / boot / arm / at91 / libat91 / tag_list.c
1 /******************************************************************************
2  *
3  * Filename: tag_list.c
4  *
5  * Instantiation of basic routines that create linux-boot tag list.
6  *
7  * Revision information:
8  *
9  * 22AUG2004    kb_admin        initial creation
10  *
11  * BEGIN_KBDD_BLOCK
12  * No warranty, expressed or implied, is included with this software.  It is
13  * provided "AS IS" and no warranty of any kind including statutory or aspects
14  * relating to merchantability or fitness for any purpose is provided.  All
15  * intellectual property rights of others is maintained with the respective
16  * owners.  This software is not copyrighted and is intended for reference
17  * only.
18  * END_BLOCK
19  *
20  * $FreeBSD$
21  *****************************************************************************/
22
23 /******************************* GLOBALS *************************************/
24
25 /********************** PRIVATE FUNCTIONS/DATA/DEFINES ***********************/
26
27 #define u32 unsigned
28 #define u16 unsigned short
29 #define u8  unsigned char
30
31 // #include "/usr/src/arm/linux/include/asm/setup.h"
32 #include <linux/asm/setup.h>
33 #include "tag_list.h"
34
35 #define PAGE_SIZE       0x1000
36 #define MEM_SIZE        0x2000000
37 #define PHYS_OFFSET     0x20000000
38
39 /*************************** GLOBAL FUNCTIONS ********************************/
40
41 /*
42  * .KB_C_FN_DEFINITION_START
43  * void InitTagList(char*, void *)
44  *  This global function populates a linux-boot style tag list from the
45  * string passed in the pointer at the location specified.
46  * .KB_C_FN_DEFINITION_END
47  */
48 void InitTagList(char *parms, void *output) {
49
50         char *src, *dst;
51         struct tag *tagList = (struct tag*)output;
52
53         tagList->hdr.size  = tag_size(tag_core);
54         tagList->hdr.tag   = ATAG_CORE;
55         tagList->u.core.flags    = 1;
56         tagList->u.core.pagesize = PAGE_SIZE;
57         tagList->u.core.rootdev  = 0xff;
58         tagList = tag_next(tagList);
59
60         tagList->hdr.size  = tag_size(tag_mem32);
61         tagList->hdr.tag   = ATAG_MEM;
62         tagList->u.mem.size  = MEM_SIZE;
63         tagList->u.mem.start = PHYS_OFFSET;
64         tagList = tag_next(tagList);
65
66         tagList->hdr.size  = tag_size(tag_cmdline);
67         tagList->hdr.tag   = ATAG_CMDLINE;
68
69         src = parms;
70         dst = tagList->u.cmdline.cmdline;
71         while (*src) {
72                 *dst++ = *src++;
73         }
74         *dst = 0;
75
76         tagList->hdr.size += ((unsigned)(src - parms) + 1) / sizeof(unsigned);
77         tagList = tag_next(tagList);
78
79         tagList->hdr.size  = 0;
80         tagList->hdr.tag   = ATAG_NONE;
81 }