summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorbz <bz@FreeBSD.org>2014-08-16 14:14:29 +0000
committerbz <bz@FreeBSD.org>2014-08-16 14:14:29 +0000
commitfdfedc3bb4681dabd75972f302f5898024d10a87 (patch)
tree9414832db50a14f715f3f945a944d936556bb1cc /sys/mips
parent1344b41f0b6c7d7948fa1ff68d4ad2a5ec47f36e (diff)
downloadFreeBSD-src-fdfedc3bb4681dabd75972f302f5898024d10a87.zip
FreeBSD-src-fdfedc3bb4681dabd75972f302f5898024d10a87.tar.gz
MFC r264605:
Based on xlp_machdep.c and completed the list of options based on boot/mips/beri/loader/metadata.c allow FDT configuration to set command line options. This leads to an interesting quesiton of future interactions with loader. However for configurations without loader this allows bootverbose or boot single user to be set by compiling a new kernel, which is good enough for testing and debugging. Reviewed by: rwatson Sponsored by: DARPA/AFRL
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/beri/beri_machdep.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/sys/mips/beri/beri_machdep.c b/sys/mips/beri/beri_machdep.c
index 85dd153..870e461 100644
--- a/sys/mips/beri/beri_machdep.c
+++ b/sys/mips/beri/beri_machdep.c
@@ -131,6 +131,46 @@ platform_reset(void)
__asm__ __volatile("wait");
}
+#ifdef FDT
+/* Parse cmd line args as env - copied from xlp_machdep. */
+/* XXX-BZ this should really be centrally provided for all (boot) code. */
+static void
+_parse_bootargs(char *cmdline)
+{
+ char *n, *v;
+
+ while ((v = strsep(&cmdline, " \n")) != NULL) {
+ if (*v == '\0')
+ continue;
+ if (*v == '-') {
+ while (*v != '\0') {
+ v++;
+ switch (*v) {
+ case 'a': boothowto |= RB_ASKNAME; break;
+ /* Someone should simulate that ;-) */
+ case 'C': boothowto |= RB_CDROM; break;
+ case 'd': boothowto |= RB_KDB; break;
+ case 'D': boothowto |= RB_MULTIPLE; break;
+ case 'm': boothowto |= RB_MUTE; break;
+ case 'g': boothowto |= RB_GDB; break;
+ case 'h': boothowto |= RB_SERIAL; break;
+ case 'p': boothowto |= RB_PAUSE; break;
+ case 'r': boothowto |= RB_DFLTROOT; break;
+ case 's': boothowto |= RB_SINGLE; break;
+ case 'v': boothowto |= RB_VERBOSE; break;
+ }
+ }
+ } else {
+ n = strsep(&v, "=");
+ if (v == NULL)
+ setenv(n, "1");
+ else
+ setenv(n, v);
+ }
+ }
+}
+#endif
+
void
platform_start(__register_t a0, __register_t a1, __register_t a2,
__register_t a3)
@@ -142,7 +182,9 @@ platform_start(__register_t a0, __register_t a1, __register_t a2,
char **envp = (char **)a2;
unsigned int memsize = a3;
#ifdef FDT
+ char buf[2048]; /* early stack supposedly big enough */
vm_offset_t dtbp;
+ phandle_t chosen;
void *kmdp;
#endif
int i;
@@ -180,6 +222,13 @@ platform_start(__register_t a0, __register_t a1, __register_t a2,
while (1);
if (OF_init((void *)dtbp) != 0)
while (1);
+
+ /*
+ * Get bootargs from FDT if specified.
+ */
+ chosen = OF_finddevice("/chosen");
+ if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1)
+ _parse_bootargs(buf);
#endif
/*
OpenPOWER on IntegriCloud