summaryrefslogtreecommitdiffstats
path: root/sys/boot/ia64/ski
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2001-09-13 12:49:02 +0000
committerdfr <dfr@FreeBSD.org>2001-09-13 12:49:02 +0000
commit78bcb999c461416eede29b0eefee3658a7d25195 (patch)
tree886c1be3d6fb2d1122f91ffa2ef3c5eb3c44e677 /sys/boot/ia64/ski
parent7b40715e824711834ec0f89ba4f0881f57b4d53a (diff)
downloadFreeBSD-src-78bcb999c461416eede29b0eefee3658a7d25195.zip
FreeBSD-src-78bcb999c461416eede29b0eefee3658a7d25195.tar.gz
Update code which creates bootinfo.
Diffstat (limited to 'sys/boot/ia64/ski')
-rw-r--r--sys/boot/ia64/ski/bootinfo.c98
-rw-r--r--sys/boot/ia64/ski/elf_freebsd.c1
-rw-r--r--sys/boot/ia64/ski/libski.h4
3 files changed, 101 insertions, 2 deletions
diff --git a/sys/boot/ia64/ski/bootinfo.c b/sys/boot/ia64/ski/bootinfo.c
index d3d95ca..9bb0f3e 100644
--- a/sys/boot/ia64/ski/bootinfo.c
+++ b/sys/boot/ia64/ski/bootinfo.c
@@ -35,8 +35,93 @@
#include <machine/bootinfo.h>
#include "bootstrap.h"
+/*
+ * Return a 'boothowto' value corresponding to the kernel arguments in
+ * (kargs) and any relevant environment variables.
+ */
+static struct
+{
+ const char *ev;
+ int mask;
+} howto_names[] = {
+ {"boot_askname", RB_ASKNAME},
+ {"boot_cdrom", RB_CDROM},
+ {"boot_userconfig", RB_CONFIG},
+ {"boot_ddb", RB_KDB},
+ {"boot_gdb", RB_GDB},
+ {"boot_single", RB_SINGLE},
+ {"boot_verbose", RB_VERBOSE},
+ {NULL, 0}
+};
+
extern char *ski_fmtdev(void *vdev);
+int
+bi_getboothowto(char *kargs)
+{
+ char *cp;
+ int howto;
+ int active;
+ int i;
+
+ /* Parse kargs */
+ howto = 0;
+ if (kargs != NULL) {
+ cp = kargs;
+ active = 0;
+ while (*cp != 0) {
+ if (!active && (*cp == '-')) {
+ active = 1;
+ } else if (active)
+ switch (*cp) {
+ case 'a':
+ howto |= RB_ASKNAME;
+ break;
+ case 'c':
+ howto |= RB_CONFIG;
+ break;
+ case 'C':
+ howto |= RB_CDROM;
+ break;
+ case 'd':
+ howto |= RB_KDB;
+ break;
+ case 'm':
+ howto |= RB_MUTE;
+ break;
+ case 'g':
+ howto |= RB_GDB;
+ break;
+ case 'h':
+ howto |= RB_SERIAL;
+ break;
+ case 'r':
+ howto |= RB_DFLTROOT;
+ break;
+ case 's':
+ howto |= RB_SINGLE;
+ break;
+ case 'v':
+ howto |= RB_VERBOSE;
+ break;
+ default:
+ active = 0;
+ break;
+ }
+ cp++;
+ }
+ }
+ /* get equivalents from the environment */
+ for (i = 0; howto_names[i].ev != NULL; i++)
+ if (getenv(howto_names[i].ev) != NULL)
+ howto |= howto_names[i].mask;
+ if (!strcmp(getenv("console"), "comconsole"))
+ howto |= RB_SERIAL;
+ if (!strcmp(getenv("console"), "nullconsole"))
+ howto |= RB_MUTE;
+ return(howto);
+}
+
/*
* Copy the environment into the load area starting at (addr).
* Each variable is formatted as <name>=<value>, with a single nul
@@ -150,7 +235,7 @@ bi_copymodules(vm_offset_t addr)
* - Module metadata are formatted and placed in kernel space.
*/
int
-bi_load(struct bootinfo *bi, struct preloaded_file *fp)
+bi_load(struct bootinfo *bi, struct preloaded_file *fp, char *args)
{
char *rootdevname;
struct ski_devdesc *rootdev;
@@ -161,6 +246,17 @@ bi_load(struct bootinfo *bi, struct preloaded_file *fp)
vm_offset_t ssym, esym;
struct file_metadata *md;
+ /*
+ * Version 1 bootinfo.
+ */
+ bi->bi_magic = BOOTINFO_MAGIC;
+ bi->bi_version = 1;
+
+ /*
+ * Calculate boothowto.
+ */
+ bi->bi_boothowto = bi_getboothowto(fp->f_args);
+
/*
* Allow the environment variable 'rootdev' to override the supplied device
* This should perhaps go to MI code and/or have $rootdev tested/set by
diff --git a/sys/boot/ia64/ski/elf_freebsd.c b/sys/boot/ia64/ski/elf_freebsd.c
index 336048e..e1ec0d2 100644
--- a/sys/boot/ia64/ski/elf_freebsd.c
+++ b/sys/boot/ia64/ski/elf_freebsd.c
@@ -90,7 +90,6 @@
#define _KERNEL
static int elf_exec(struct preloaded_file *amp);
-int bi_load(struct bootinfo *, struct preloaded_file *);
struct file_format ia64_elf = { elf_loadfile, elf_exec };
diff --git a/sys/boot/ia64/ski/libski.h b/sys/boot/ia64/ski/libski.h
index e4d0932..d292278 100644
--- a/sys/boot/ia64/ski/libski.h
+++ b/sys/boot/ia64/ski/libski.h
@@ -74,6 +74,10 @@ extern ssize_t ski_readin(int fd, vm_offset_t dest, size_t len);
extern int ski_boot(void);
extern int ski_autoload(void);
+struct bootinfo;
+struct preloaded_file;
+extern int bi_load(struct bootinfo *, struct preloaded_file *);
+
#define SSC_CONSOLE_INIT 20
#define SSC_GETCHAR 21
#define SSC_PUTCHAR 31
OpenPOWER on IntegriCloud