tag_list.c revision 157873
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: head/sys/boot/arm/at91/libat91/tag_list.c 157873 2006-04-19 17:16:49Z imp $ 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 31157873Simp#include "/usr/src/arm/linux/include/asm/setup.h" 32157873Simp 33157873Simp#define PAGE_SIZE 0x1000 34157873Simp#define MEM_SIZE 0x2000000 35157873Simp#define PHYS_OFFSET 0x20000000 36157873Simp 37157873Simp/*************************** GLOBAL FUNCTIONS ********************************/ 38157873Simp 39157873Simp/* 40157873Simp * .KB_C_FN_DEFINITION_START 41157873Simp * void InitTagList(char*, void *) 42157873Simp * This global function populates a linux-boot style tag list from the 43157873Simp * string passed in the pointer at the location specified. 44157873Simp * .KB_C_FN_DEFINITION_END 45157873Simp */ 46157873Simpvoid InitTagList(char *parms, void *output) { 47157873Simp 48157873Simp char *src, *dst; 49157873Simp struct tag *tagList = (struct tag*)output; 50157873Simp 51157873Simp tagList->hdr.size = tag_size(tag_core); 52157873Simp tagList->hdr.tag = ATAG_CORE; 53157873Simp tagList->u.core.flags = 1; 54157873Simp tagList->u.core.pagesize = PAGE_SIZE; 55157873Simp tagList->u.core.rootdev = 0xff; 56157873Simp tagList = tag_next(tagList); 57157873Simp 58157873Simp tagList->hdr.size = tag_size(tag_mem32); 59157873Simp tagList->hdr.tag = ATAG_MEM; 60157873Simp tagList->u.mem.size = MEM_SIZE; 61157873Simp tagList->u.mem.start = PHYS_OFFSET; 62157873Simp tagList = tag_next(tagList); 63157873Simp 64157873Simp tagList->hdr.size = tag_size(tag_cmdline); 65157873Simp tagList->hdr.tag = ATAG_CMDLINE; 66157873Simp 67157873Simp src = parms; 68157873Simp dst = tagList->u.cmdline.cmdline; 69157873Simp while (*src) { 70157873Simp *dst++ = *src++; 71157873Simp } 72157873Simp *dst = 0; 73157873Simp 74157873Simp tagList->hdr.size += ((unsigned)(src - parms) + 1) / sizeof(unsigned); 75157873Simp tagList = tag_next(tagList); 76157873Simp 77157873Simp tagList->hdr.size = 0; 78157873Simp tagList->hdr.tag = ATAG_NONE; 79157873Simp} 80