khypervisor  v1
Data Structures | Defines | Functions | Variables
loadlinux.c File Reference
#include "loadlinux.h"
#include <log/string.h>
#include <log/print.h>
Include dependency graph for loadlinux.c:

Go to the source code of this file.

Data Structures

struct  atag_header
struct  atag_core
struct  atag_mem
struct  atag_serialnr
struct  atag_revision
struct  atag_cmdline
struct  atag_ramdisk
struct  atag_videotext
struct  atag_initrd2
struct  atag_videolfb
struct  atag

Defines

#define ATAG_NONE   0x00000000
#define ATAG_CORE   0x54410001
#define ATAG_MEM   0x54410002
#define ATAG_VIDEOTEXT   0x54410003
#define ATAG_RAMDISK   0x54410004
#define ATAG_INITRD2   0x54420005
#define ATAG_SERIAL   0x54410006
#define ATAG_REVISION   0x54410007
#define ATAG_VIDEOLFB   0x54410008
#define ATAG_CMDLINE   0x54410009
#define tag_next(t)   ((struct atag *)((uint32_t *)(t) + (t)->hdr.size))
#define tag_size(type)   ((sizeof(struct atag_header) + sizeof(struct type)) >> 2)

Functions

static void setup_core_tag (void *address, long pagesize)
static void setup_revision_tag (void)
static void setup_cmdline_tag (const char *line)
static void setup_mem_tag (uint32_t start, uint32_t len)
static void setup_end_tag (void)
void loadlinux_setup_tags (uint32_t *src)

Variables

static struct atag_params

Define Documentation

#define ATAG_CMDLINE   0x54410009

Definition at line 15 of file loadlinux.c.

#define ATAG_CORE   0x54410001

Definition at line 7 of file loadlinux.c.

#define ATAG_INITRD2   0x54420005

Definition at line 11 of file loadlinux.c.

#define ATAG_MEM   0x54410002

Definition at line 8 of file loadlinux.c.

#define ATAG_NONE   0x00000000

Definition at line 6 of file loadlinux.c.

#define ATAG_RAMDISK   0x54410004

Definition at line 10 of file loadlinux.c.

#define ATAG_REVISION   0x54410007

Definition at line 13 of file loadlinux.c.

#define ATAG_SERIAL   0x54410006

Definition at line 12 of file loadlinux.c.

#define ATAG_VIDEOLFB   0x54410008

Definition at line 14 of file loadlinux.c.

#define ATAG_VIDEOTEXT   0x54410003

Definition at line 9 of file loadlinux.c.

#define tag_next (   t)    ((struct atag *)((uint32_t *)(t) + (t)->hdr.size))

Definition at line 17 of file loadlinux.c.

#define tag_size (   type)    ((sizeof(struct atag_header) + sizeof(struct type)) >> 2)

Definition at line 18 of file loadlinux.c.


Function Documentation

void loadlinux_setup_tags ( uint32_t src)

Definition at line 154 of file loadlinux.c.

{
    char *commandline = "root=/dev/ram rw earlyprintk console=ttyAMA0 mem=256M rdinit=/sbin/init";
    setup_core_tag(src+(0x100/4), 4096);       /* standard core tag 4k pagesize */
    setup_cmdline_tag(commandline);    /* commandline setting root device */
    setup_revision_tag();
    setup_mem_tag((uint32_t)(src-(0x20000000/4)), 0x10000000);
    /* end of tags */
    setup_end_tag();
}

Here is the call graph for this function:

static void setup_cmdline_tag ( const char *  line) [static]

Definition at line 121 of file loadlinux.c.

{
    int linelen = strlen(line);

    if(!linelen)
        return;                             /* do not insert a tag for an empty commandline */

    _params->hdr.tag = ATAG_CMDLINE;         /* Commandline tag */
    _params->hdr.size = (sizeof(struct atag_header) + linelen + 1 + 4) >> 2;

    strcpy(_params->u.cmdline.cmdline,line); /* place commandline into tag */

    _params = tag_next(_params);              /* move pointer to next tag */
}
static void setup_core_tag ( void *  address,
long  pagesize 
) [static]

Definition at line 100 of file loadlinux.c.

{
    _params = (struct atag *)address;         /* Initialise parameters to start at given address */

    _params->hdr.tag = ATAG_CORE;            /* start with the core tag */
    _params->hdr.size = tag_size(atag_core); /* size the tag */
    _params->u.core.flags = 1;               /* ensure read-only */
    _params->u.core.pagesize = pagesize;     /* systems pagesize (4k) */
    _params->u.core.rootdev = 0;             /* zero root device (typicaly overidden from commandline )*/

    _params = tag_next(_params);              /* move pointer to next tag */
}
static void setup_end_tag ( void  ) [static]

Definition at line 148 of file loadlinux.c.

{
    _params->hdr.tag = ATAG_NONE;            /* Empty tag ends list */
    _params->hdr.size = 0;                   /* zero length */
}
static void setup_mem_tag ( uint32_t  start,
uint32_t  len 
) [static]

Definition at line 136 of file loadlinux.c.

{
    printh("setup_mem_tag start :  %x len : %x\n", start, len);
    _params->hdr.tag = ATAG_MEM;             /* Memory tag */
    _params->hdr.size = tag_size(atag_mem);  /* size tag */

    _params->u.mem.start = start;            /* Start of memory area (physical address) */
    _params->u.mem.size = len;               /* Length of area */

    _params = tag_next(_params);              /* move pointer to next tag */
}
static void setup_revision_tag ( void  ) [static]

Definition at line 113 of file loadlinux.c.


Variable Documentation

struct atag* _params [static]

Definition at line 98 of file loadlinux.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines