Changeset View
Changeset View
Standalone View
Standalone View
head/sys/mips/mediatek/mtk_machdep.c
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | mips_init(void) | ||||
mutex_init(); | mutex_init(); | ||||
kdb_init(); | kdb_init(); | ||||
#ifdef KDB | #ifdef KDB | ||||
if (boothowto & RB_KDB) | if (boothowto & RB_KDB) | ||||
kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); | kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger"); | ||||
#endif | #endif | ||||
} | } | ||||
static void | |||||
_parse_bootarg(char *v) | |||||
imp: CAn we please *STOP* copying this over and over again?
| |||||
{ | |||||
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 | void | ||||
platform_reset(void) | platform_reset(void) | ||||
{ | { | ||||
mtk_soc_reset(); | mtk_soc_reset(); | ||||
} | } | ||||
void | void | ||||
platform_start(__register_t a0 __unused, __register_t a1 __unused, | platform_start(__register_t a0 __unused, __register_t a1 __unused, | ||||
__register_t a2 __unused, __register_t a3 __unused) | __register_t a2 __unused, __register_t a3 __unused) | ||||
{ | { | ||||
vm_offset_t kernend; | vm_offset_t kernend; | ||||
int argc = a0, i;//, res; | int argc = a0, i;//, res; | ||||
uint32_t timer_clk; | uint32_t timer_clk; | ||||
char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1); | char **argv = (char **)MIPS_PHYS_TO_KSEG0(a1); | ||||
char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2); | char **envp = (char **)MIPS_PHYS_TO_KSEG0(a2); | ||||
void *dtbp; | void *dtbp; | ||||
phandle_t chosen; | |||||
char buf[2048]; | |||||
/* clear the BSS and SBSS segments */ | /* clear the BSS and SBSS segments */ | ||||
kernend = (vm_offset_t)&end; | kernend = (vm_offset_t)&end; | ||||
memset(&edata, 0, kernend - (vm_offset_t)(&edata)); | memset(&edata, 0, kernend - (vm_offset_t)(&edata)); | ||||
mips_postboot_fixup(); | mips_postboot_fixup(); | ||||
/* Initialize pcpu stuff */ | /* Initialize pcpu stuff */ | ||||
Show All 12 Lines | platform_start(__register_t a0 __unused, __register_t a1 __unused, | ||||
mips_timer_early_init(timer_clk); | mips_timer_early_init(timer_clk); | ||||
/* initialize console so that we have printf */ | /* initialize console so that we have printf */ | ||||
boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */ | boothowto |= (RB_SERIAL | RB_MULTIPLE); /* Use multiple consoles */ | ||||
boothowto |= (RB_VERBOSE); | boothowto |= (RB_VERBOSE); | ||||
cninit(); | cninit(); | ||||
init_static_kenv(boot1_env, sizeof(boot1_env)); | 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("FDT DTB at: 0x%08x\n", (uint32_t)dtbp); | ||||
printf("CPU clock: %4dMHz\n", mtk_soc_get_cpuclk()/(1000*1000)); | printf("CPU clock: %4dMHz\n", mtk_soc_get_cpuclk()/(1000*1000)); | ||||
printf("Timer clock: %4dMHz\n", timer_clk/(1000*1000)); | printf("Timer clock: %4dMHz\n", timer_clk/(1000*1000)); | ||||
printf("UART clock: %4dMHz\n\n", mtk_soc_get_uartclk()/(1000*1000)); | printf("UART clock: %4dMHz\n\n", mtk_soc_get_uartclk()/(1000*1000)); | ||||
printf("U-Boot args (from %d args):\n", argc - 1); | printf("U-Boot args (from %d args):\n", argc - 1); | ||||
Show All 39 Lines |
CAn we please *STOP* copying this over and over again?