Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F137935188
D7846.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D7846.diff
View Options
Index: head/sys/dev/ofw/ofw_subr.h
===================================================================
--- head/sys/dev/ofw/ofw_subr.h
+++ head/sys/dev/ofw/ofw_subr.h
@@ -46,4 +46,6 @@
int ofw_reg_to_paddr(phandle_t _dev, int _regno, bus_addr_t *_paddr,
bus_size_t *_size, pcell_t *_pci_hi);
+int ofw_parse_bootargs(void);
+
#endif
Index: head/sys/dev/ofw/ofw_subr.c
===================================================================
--- head/sys/dev/ofw/ofw_subr.c
+++ head/sys/dev/ofw/ofw_subr.c
@@ -34,6 +34,7 @@
#include <sys/param.h>
#include <sys/bus.h>
#include <sys/libkern.h>
+#include <sys/reboot.h>
#include <sys/rman.h>
#include <machine/bus.h>
@@ -180,3 +181,64 @@
return (0);
}
+
+/* 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);
+ }
+ }
+}
+
+/*
+ * This is intended to be called early on, right after the OF system is
+ * initialized, so pmap may not be up yet.
+ */
+int
+ofw_parse_bootargs(void)
+{
+ phandle_t chosen;
+ char buf[2048]; /* early stack supposedly big enough */
+ int err;
+
+ chosen = OF_finddevice("/chosen");
+ if (chosen <= 0)
+ return (chosen);
+
+ if ((err = OF_getprop(chosen, "bootargs", buf, sizeof(buf))) != -1) {
+ _parse_bootargs(buf);
+ return (0);
+ }
+
+ return (err);
+}
Index: head/sys/powerpc/ofw/ofw_machdep.c
===================================================================
--- head/sys/powerpc/ofw/ofw_machdep.c
+++ head/sys/powerpc/ofw/ofw_machdep.c
@@ -99,6 +99,7 @@
/*
* Saved SPRG0-3 from OpenFirmware. Will be restored prior to the callback.
*/
+#ifndef __powerpc64__
register_t ofw_sprg0_save;
static __inline void
@@ -140,6 +141,8 @@
}
#endif
+#endif
+
static int
parse_ofw_memory(phandle_t node, const char *prop, struct mem_region *output)
{
@@ -344,11 +347,12 @@
ofmsr[0] = mfmsr();
#ifdef __powerpc64__
ofmsr[0] &= ~PSL_SF;
- #endif
+ #else
__asm __volatile("mfsprg0 %0" : "=&r"(ofmsr[1]));
__asm __volatile("mfsprg1 %0" : "=&r"(ofmsr[2]));
__asm __volatile("mfsprg2 %0" : "=&r"(ofmsr[3]));
__asm __volatile("mfsprg3 %0" : "=&r"(ofmsr[4]));
+ #endif
openfirmware_entry = openfirm;
if (ofmsr[0] & PSL_DR)
@@ -440,7 +444,9 @@
*/
oldmsr = intr_disable();
+#ifndef __powerpc64__
ofw_sprg_prepare();
+#endif
/* Save trap vectors */
ofw_save_trap_vec(save_trap_of);
@@ -463,7 +469,9 @@
/* Restore trap vecotrs */
ofw_restore_trap_vec(save_trap_of);
+#ifndef __powerpc64__
ofw_sprg_restore();
+#endif
intr_restore(oldmsr);
Index: head/sys/powerpc/powerpc/machdep.c
===================================================================
--- head/sys/powerpc/powerpc/machdep.c
+++ head/sys/powerpc/powerpc/machdep.c
@@ -128,6 +128,7 @@
#include <ddb/ddb.h>
#include <dev/ofw/openfirm.h>
+#include <dev/ofw/ofw_subr.h>
int cold = 1;
#ifdef __powerpc64__
@@ -297,6 +298,8 @@
/* Store boot environment state */
OF_initial_setup((void *)fdt, NULL, (int (*)(void *))ofentry);
+ ofw_parse_bootargs();
+
/*
* Init params/tunables that can be overridden by the loader
*/
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 28, 10:31 AM (17 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
26273071
Default Alt Text
D7846.diff (3 KB)
Attached To
Mode
D7846: Add a ofw_parse_bootargs function, and use it for powerpc
Attached
Detach File
Event Timeline
Log In to Comment