summaryrefslogtreecommitdiffstats
path: root/sys/mips/rt305x/rt305x_machdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/mips/rt305x/rt305x_machdep.c')
-rw-r--r--sys/mips/rt305x/rt305x_machdep.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/mips/rt305x/rt305x_machdep.c b/sys/mips/rt305x/rt305x_machdep.c
index dab2ce6..54e7906 100644
--- a/sys/mips/rt305x/rt305x_machdep.c
+++ b/sys/mips/rt305x/rt305x_machdep.c
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
#include <machine/vmparam.h>
#include <mips/rt305x/rt305xreg.h>
+#include <mips/rt305x/rt305x_sysctlvar.h>
extern int *edata;
extern int *end;
@@ -87,11 +88,17 @@ static void
mips_init(void)
{
int i;
+ char *memsize;
printf("entry: mips_init()\n");
+ if ((memsize = kern_getenv("memsize")) != NULL)
+ realmem = btoc(strtol(memsize, NULL, 0) << 20);
+ else
+ realmem = btoc(32 << 20);
+
+
bootverbose = 1;
- realmem = btoc(32 << 20);
for (i = 0; i < 10; i++) {
phys_avail[i] = 0;
@@ -120,8 +127,13 @@ void
platform_reset(void)
{
+#if !defined(MT7620) && !defined(RT5350)
__asm __volatile("li $25, 0xbf000000");
__asm __volatile("j $25");
+#else
+ rt305x_sysctl_set(SYSCTL_RSTCTRL, 1);
+ while (1);
+#endif
}
void
@@ -144,6 +156,8 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
/* Initialize pcpu stuff */
mips_pcpu0_init();
+ mips_timer_early_init(platform_counter_freq / 2);
+
/* initialize console so that we have printf */
boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */
boothowto |= (RB_VERBOSE);
@@ -173,10 +187,12 @@ platform_start(__register_t a0 __unused, __register_t a1 __unused,
printf("Environment:\n");
- for (i = 0; envp[i] ; i++) {
+ for (i = 0; envp[i] && MIPS_IS_VALID_PTR(envp[i]); i++) {
char *n, *arg;
arg = (char *)(intptr_t)MIPS_PHYS_TO_KSEG0(envp[i]);
+ if (! MIPS_IS_VALID_PTR(arg))
+ continue;
printf("\t%s\n", arg);
n = strsep(&arg, "=");
if (arg == NULL)
OpenPOWER on IntegriCloud