Updated PCI IDs to latest snapshot.
[tangerine.git] / arch / ppc-chrp / efika / bootloader / bootloader_init.c
blob48f445ad20c53f7b278d27aeb50a2654dedcee8c
1 /*
2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
3 $Id$
5 Bootloader information initialisation.
6 */
8 #define DEBUG 1
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <exec/memory.h>
13 #include <exec/resident.h>
14 #include <utility/utility.h>
15 #include <utility/tagitem.h>
16 #include <proto/exec.h>
17 #include <proto/bootloader.h>
18 #include <proto/utility.h>
19 #include <proto/kernel.h>
21 #include <aros/symbolsets.h>
22 #include <aros/bootloader.h>
23 #include <aros/kernel.h>
24 #include "bootloader_intern.h"
25 #include LC_LIBDEFS_FILE
27 #include <string.h>
29 static int GM_UNIQUENAME(Init)(LIBBASETYPEPTR BootLoaderBase)
31 void *KernelBase = OpenResource("kernel.resource");
32 struct TagItem *msg = KrnGetBootInfo();
33 IPTR tmp;
35 BootLoaderBase->Flags = 0;
37 NEWLIST(&(BootLoaderBase->Args));
38 NEWLIST(&(BootLoaderBase->DriveInfo));
40 D(bug("[BootLdr] Init. msg=%p\n", msg));
42 /* Right. Now we extract the data currently placed in 0x1000 by exec */
43 if (msg)
45 BootLoaderBase->LdrName = "UBootSecondLevelBootloader";
46 BootLoaderBase->Flags |= MB_FLAGS_LDRNAME;
48 tmp = GetTagData(KRN_CmdLine, 0, msg);
49 D(bug("[BootLdr] KRN_CmdLine=%p\n", tmp));
50 if (tmp)
52 STRPTR cmd,buff;
53 ULONG temp;
54 struct Node *node;
56 D(bug("[BootLdr] CmdLine=\"%s\"\n", (STRPTR)tmp));
58 /* First make a working copy of the command line */
59 if ((buff = AllocMem(200,MEMF_ANY|MEMF_CLEAR)))
61 strncpy(buff, (STRPTR)tmp, 200);
62 /* remove any leading spaces */
63 cmd = stpblk(buff);
64 while(cmd[0])
66 /* Split the command line */
67 temp = strcspn(cmd," ");
68 cmd[temp++] = 0x00;
69 D(bug("[BootLdr] Init: Argument %s\n",cmd));
70 /* Allocate node and insert into list */
71 node = AllocMem(sizeof(struct Node),MEMF_ANY|MEMF_CLEAR);
72 node->ln_Name = cmd;
73 AddTail(&(BootLoaderBase->Args),node);
74 /* Skip to next part */
75 cmd = stpblk(cmd+temp);
78 BootLoaderBase->Flags |= MB_FLAGS_CMDLINE;
82 return TRUE;
85 ADD2INITLIB(GM_UNIQUENAME(Init), 0)