tag_list.c revision 157873
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: head/sys/boot/arm/at91/libat91/tag_list.c 157873 2006-04-19 17:16:49Z imp $ 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 33#define PAGE_SIZE 0x1000 34#define MEM_SIZE 0x2000000 35#define PHYS_OFFSET 0x20000000 36 37/*************************** GLOBAL FUNCTIONS ********************************/ 38 39/* 40 * .KB_C_FN_DEFINITION_START 41 * void InitTagList(char*, void *) 42 * This global function populates a linux-boot style tag list from the 43 * string passed in the pointer at the location specified. 44 * .KB_C_FN_DEFINITION_END 45 */ 46void InitTagList(char *parms, void *output) { 47 48 char *src, *dst; 49 struct tag *tagList = (struct tag*)output; 50 51 tagList->hdr.size = tag_size(tag_core); 52 tagList->hdr.tag = ATAG_CORE; 53 tagList->u.core.flags = 1; 54 tagList->u.core.pagesize = PAGE_SIZE; 55 tagList->u.core.rootdev = 0xff; 56 tagList = tag_next(tagList); 57 58 tagList->hdr.size = tag_size(tag_mem32); 59 tagList->hdr.tag = ATAG_MEM; 60 tagList->u.mem.size = MEM_SIZE; 61 tagList->u.mem.start = PHYS_OFFSET; 62 tagList = tag_next(tagList); 63 64 tagList->hdr.size = tag_size(tag_cmdline); 65 tagList->hdr.tag = ATAG_CMDLINE; 66 67 src = parms; 68 dst = tagList->u.cmdline.cmdline; 69 while (*src) { 70 *dst++ = *src++; 71 } 72 *dst = 0; 73 74 tagList->hdr.size += ((unsigned)(src - parms) + 1) / sizeof(unsigned); 75 tagList = tag_next(tagList); 76 77 tagList->hdr.size = 0; 78 tagList->hdr.tag = ATAG_NONE; 79} 80