Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F177654711
D5979.1794956563.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D5979.1794956563.diff
View Options
Index: head/sys/mips/mediatek/mtk_machdep.c
===================================================================
--- head/sys/mips/mediatek/mtk_machdep.c
+++ head/sys/mips/mediatek/mtk_machdep.c
@@ -192,6 +192,52 @@
#endif
}
+static void
+_parse_bootarg(char *v)
+{
+ char *n;
+
+ 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);
+ }
+}
+
+/* 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 *v;
+
+ while ((v = strsep(&cmdline, " \n")) != NULL) {
+ if (*v == '\0')
+ continue;
+ _parse_bootarg(v);
+ }
+}
+
void
platform_reset(void)
{
@@ -209,6 +255,8 @@
char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1);
char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2);
void *dtbp;
+ phandle_t chosen;
+ char buf[2048];
/* clear the BSS and SBSS segments */
kernend = (vm_offset_t)&end;
@@ -238,6 +286,13 @@
init_static_kenv(boot1_env, sizeof(boot1_env));
+ /*
+ * Get bsdbootargs from FDT if specified.
+ */
+ chosen = OF_finddevice("/chosen");
+ if (OF_getprop(chosen, "bsdbootargs", buf, sizeof(buf)) != -1)
+ _parse_bootargs(buf);
+
printf("FDT DTB at: 0x%08x\n", (uint32_t)dtbp);
printf("CPU clock: %4dMHz\n", mtk_soc_get_cpuclk()/(1000*1000));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 17, 11:02 PM (22 m, 34 s)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
41809849
Default Alt Text
D5979.1794956563.diff (1 KB)
Attached To
Mode
D5979: Add support for boot arguments specification via fdt
Attached
Detach File
Event Timeline