diff options
-rw-r--r-- | arch/arc/Kconfig | 11 | ||||
-rw-r--r-- | arch/arc/kernel/head.S | 26 | ||||
-rw-r--r-- | arch/arc/kernel/setup.c | 39 |
3 files changed, 34 insertions, 42 deletions
diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig index 9063ae6553cc..c1f76f7424ac 100644 --- a/arch/arc/Kconfig +++ b/arch/arc/Kconfig | |||
@@ -409,17 +409,6 @@ config ARC_DBG_TLB_MISS_COUNT | |||
409 | Counts number of I and D TLB Misses and exports them via Debugfs | 409 | Counts number of I and D TLB Misses and exports them via Debugfs |
410 | The counters can be cleared via Debugfs as well | 410 | The counters can be cleared via Debugfs as well |
411 | 411 | ||
412 | config CMDLINE_UBOOT | ||
413 | bool "Support U-boot kernel command line passing" | ||
414 | default n | ||
415 | help | ||
416 | If you are using U-boot (www.denx.de) and wish to pass the kernel | ||
417 | command line from the U-boot environment to the Linux kernel then | ||
418 | switch this option on. | ||
419 | ARC U-boot will setup the cmdline in RAM/flash and set r2 to point | ||
420 | to it. kernel startup code will append this to DeviceTree | ||
421 | /bootargs provided cmdline args. | ||
422 | |||
423 | config ARC_BUILTIN_DTB_NAME | 412 | config ARC_BUILTIN_DTB_NAME |
424 | string "Built in DTB" | 413 | string "Built in DTB" |
425 | help | 414 | help |
diff --git a/arch/arc/kernel/head.S b/arch/arc/kernel/head.S index 2c878e964a64..991997269d02 100644 --- a/arch/arc/kernel/head.S +++ b/arch/arc/kernel/head.S | |||
@@ -49,25 +49,13 @@ stext: | |||
49 | st.ab 0, [r5,4] | 49 | st.ab 0, [r5,4] |
50 | brlt r5, r6, 1b | 50 | brlt r5, r6, 1b |
51 | 51 | ||
52 | #ifdef CONFIG_CMDLINE_UBOOT | 52 | ; Uboot - kernel ABI |
53 | ; support for bootloader provided cmdline | 53 | ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2 |
54 | ; If cmdline passed by u-boot, then | 54 | ; r1 = magic number (board identity, unused as of now |
55 | ; r0 = 1 (because ATAGS parsing, now retired, used to use 0) | 55 | ; r2 = pointer to uboot provided cmdline or external DTB in mem |
56 | ; r1 = magic number (board identity) | 56 | ; These are handled later in setup_arch() |
57 | ; r2 = addr of cmdline string (somewhere in memory/flash) | 57 | st r0, [@uboot_tag] |
58 | 58 | st r2, [@uboot_arg] | |
59 | brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline | ||
60 | breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL | ||
61 | |||
62 | mov r5, @command_line | ||
63 | 1: | ||
64 | ldb.ab r6, [r2, 1] | ||
65 | breq r6, 0, .Lother_bootup_chores | ||
66 | b.d 1b | ||
67 | stb.ab r6, [r5, 1] | ||
68 | #endif | ||
69 | |||
70 | .Lother_bootup_chores: | ||
71 | 59 | ||
72 | ; Identify if running on ISS vs Silicon | 60 | ; Identify if running on ISS vs Silicon |
73 | ; IDENTITY Reg [ 3 2 1 0 ] | 61 | ; IDENTITY Reg [ 3 2 1 0 ] |
diff --git a/arch/arc/kernel/setup.c b/arch/arc/kernel/setup.c index 643eae4436e0..ffb60b4f6f86 100644 --- a/arch/arc/kernel/setup.c +++ b/arch/arc/kernel/setup.c | |||
@@ -29,7 +29,10 @@ | |||
29 | 29 | ||
30 | int running_on_hw = 1; /* vs. on ISS */ | 30 | int running_on_hw = 1; /* vs. on ISS */ |
31 | 31 | ||
32 | char __initdata command_line[COMMAND_LINE_SIZE]; | 32 | /* Part of U-boot ABI: see head.S */ |
33 | int __initdata uboot_tag; | ||
34 | char __initdata *uboot_arg; | ||
35 | |||
33 | const struct machine_desc *machine_desc; | 36 | const struct machine_desc *machine_desc; |
34 | 37 | ||
35 | struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ | 38 | struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ |
@@ -311,19 +314,31 @@ void setup_processor(void) | |||
311 | arc_chk_fpu(); | 314 | arc_chk_fpu(); |
312 | } | 315 | } |
313 | 316 | ||
317 | static inline int is_kernel(unsigned long addr) | ||
318 | { | ||
319 | if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end) | ||
320 | return 1; | ||
321 | return 0; | ||
322 | } | ||
323 | |||
314 | void __init setup_arch(char **cmdline_p) | 324 | void __init setup_arch(char **cmdline_p) |
315 | { | 325 | { |
316 | /* This also populates @boot_command_line from /bootargs */ | 326 | machine_desc = setup_machine_fdt(__dtb_start); |
317 | machine_desc = setup_machine_fdt(__dtb_start); | 327 | if (!machine_desc) |
318 | if (!machine_desc) | 328 | panic("Embedded DT invalid\n"); |
319 | panic("Embedded DT invalid\n"); | 329 | |
320 | 330 | /* | |
321 | /* Append any u-boot provided cmdline */ | 331 | * Append uboot cmdline to embedded DT cmdline. |
322 | #ifdef CONFIG_CMDLINE_UBOOT | 332 | * setup_machine_fdt() would have populated @boot_command_line |
323 | /* Add a whitespace seperator between the 2 cmdlines */ | 333 | */ |
324 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); | 334 | if (uboot_tag == 1) { |
325 | strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE); | 335 | BUG_ON(is_kernel(unsigned long)uboot_arg); |
326 | #endif | 336 | |
337 | /* Ensure a whitespace between the 2 cmdlines */ | ||
338 | strlcat(boot_command_line, " ", COMMAND_LINE_SIZE); | ||
339 | strlcat(boot_command_line, uboot_arg, | ||
340 | COMMAND_LINE_SIZE); | ||
341 | } | ||
327 | 342 | ||
328 | /* Save unparsed command line copy for /proc/cmdline */ | 343 | /* Save unparsed command line copy for /proc/cmdline */ |
329 | *cmdline_p = boot_command_line; | 344 | *cmdline_p = boot_command_line; |