More minor IPI work.
[dragonfly/vkernel-mp.git] / sys / boot / ia64 / skiload / main.c
blob262abe7589865b5d17b47177633e49138e451036
1 /*-
2 * Copyright (c) 1998 Michael Smith <msmith@freebsd.org>
3 * Copyright (c) 1998,2000 Doug Rabson <dfr@freebsd.org>
4 * All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 * SUCH DAMAGE.
27 * $FreeBSD: src/sys/boot/ia64/skiload/main.c,v 1.4 2003/07/17 01:49:59 marcel Exp $
28 * $DragonFly: src/sys/boot/ia64/skiload/main.c,v 1.1 2003/11/10 07:08:37 dillon Exp $
31 #include <stand.h>
32 #include <string.h>
33 #include <setjmp.h>
34 #include <machine/fpu.h>
36 #include "bootstrap.h"
37 #include "libski.h"
39 extern char bootprog_name[];
40 extern char bootprog_rev[];
41 extern char bootprog_date[];
42 extern char bootprog_maker[];
44 struct ski_devdesc currdev; /* our current device */
45 struct arch_switch archsw; /* MI/MD interface boundary */
47 void
48 ski_main(void)
50 static char malloc[512*1024];
51 int i;
53 /*
54 * initialise the heap as early as possible. Once this is done,
55 * alloc() is usable. The stack is buried inside us, so this is
56 * safe.
58 setheap((void *)malloc, (void *)(malloc + 512*1024));
60 /*
61 * XXX Chicken-and-egg problem; we want to have console output
62 * early, but some console attributes may depend on reading from
63 * eg. the boot device, which we can't do yet. We can use
64 * printf() etc. once this is done.
66 cons_probe();
69 * Initialise the block cache
71 bcache_init(32, 512); /* 16k XXX tune this */
74 * March through the device switch probing for things.
76 for (i = 0; devsw[i] != NULL; i++)
77 if (devsw[i]->dv_init != NULL)
78 (devsw[i]->dv_init)();
80 printf("\n");
81 printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
82 printf("(%s, %s)\n", bootprog_maker, bootprog_date);
83 #if 0
84 printf("Memory: %ld k\n", memsize() / 1024);
85 #endif
87 /* XXX presumes that biosdisk is first in devsw */
88 currdev.d_dev = devsw[0];
89 currdev.d_type = currdev.d_dev->dv_type;
90 currdev.d_kind.skidisk.unit = 0;
91 /* XXX should be able to detect this, default to autoprobe */
92 currdev.d_kind.skidisk.slice = -1;
93 /* default to 'a' */
94 currdev.d_kind.skidisk.partition = 0;
96 #if 0
97 /* Create arc-specific variables */
98 bootfile = GetEnvironmentVariable(ARCENV_BOOTFILE);
99 if (bootfile)
100 setenv("bootfile", bootfile, 1);
101 #endif
103 env_setenv("currdev", EV_VOLATILE, ski_fmtdev(&currdev),
104 ski_setcurrdev, env_nounset);
105 env_setenv("loaddev", EV_VOLATILE, ski_fmtdev(&currdev), env_noset,
106 env_nounset);
108 setenv("LINES", "24", 1); /* optional */
110 archsw.arch_autoload = ski_autoload;
111 archsw.arch_getdev = ski_getdev;
112 archsw.arch_copyin = ski_copyin;
113 archsw.arch_copyout = ski_copyout;
114 archsw.arch_readin = ski_readin;
116 interact(); /* doesn't return */
118 exit(0);
121 COMMAND_SET(quit, "quit", "exit the loader", command_quit);
123 static int
124 command_quit(int argc, char *argv[])
126 exit(0);
127 return (CMD_OK);