From ce7fd13aff988d9a77cd541ce0220ae53fd3a3ac Mon Sep 17 00:00:00 2001 From: Justin Hibbits Date: Tue, 14 Nov 2017 03:23:46 +0000 Subject: [PATCH] Convert BERI to use ofw_parse_bootargs() Summary: ofw_parse_bootargs() was added in r306065 as an attempt to unify the various copies of the same code. This simply migrates BERI to use it. Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D12962 --- sys/mips/beri/beri_machdep.c | 45 ++---------------------------------- 1 file changed, 2 insertions(+), 43 deletions(-) diff --git a/sys/mips/beri/beri_machdep.c b/sys/mips/beri/beri_machdep.c index 2c153e47c79..3624b584334 100644 --- a/sys/mips/beri/beri_machdep.c +++ b/sys/mips/beri/beri_machdep.c @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #ifdef FDT #include #include +#include #endif #include @@ -161,46 +162,6 @@ 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) - kern_setenv(n, "1"); - else - kern_setenv(n, v); - } - } -} -#endif - void platform_start(__register_t a0, __register_t a1, __register_t a2, __register_t a3) @@ -279,9 +240,7 @@ platform_start(__register_t a0, __register_t a1, __register_t a2, /* * Get bootargs from FDT if specified. */ - chosen = OF_finddevice("/chosen"); - if (OF_getprop(chosen, "bootargs", buf, sizeof(buf)) != -1) - _parse_bootargs(buf); + ofw_parse_bootargs(); #endif /* -- 2.45.0