ARC: [cmdline] uboot cmdline handling rework

* Moved cmdline copy from asm to "C" - allows for more robust checking
  of pointer validity etc.

* Remove the Kconfig option to do so, base it on a runtime value passed
  by u-boot

Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
This commit is contained in:
Vineet Gupta 2014-01-16 15:01:24 +05:30
parent d8e8c7dda1
commit 59ed941353
3 changed files with 33 additions and 41 deletions

View File

@ -409,17 +409,6 @@ config ARC_DBG_TLB_MISS_COUNT
Counts number of I and D TLB Misses and exports them via Debugfs
The counters can be cleared via Debugfs as well
config CMDLINE_UBOOT
bool "Support U-boot kernel command line passing"
default n
help
If you are using U-boot (www.denx.de) and wish to pass the kernel
command line from the U-boot environment to the Linux kernel then
switch this option on.
ARC U-boot will setup the cmdline in RAM/flash and set r2 to point
to it. kernel startup code will append this to DeviceTree
/bootargs provided cmdline args.
config ARC_BUILTIN_DTB_NAME
string "Built in DTB"
help

View File

@ -49,25 +49,13 @@ stext:
st.ab 0, [r5,4]
brlt r5, r6, 1b
#ifdef CONFIG_CMDLINE_UBOOT
; support for bootloader provided cmdline
; If cmdline passed by u-boot, then
; r0 = 1 (because ATAGS parsing, now retired, used to use 0)
; r1 = magic number (board identity)
; r2 = addr of cmdline string (somewhere in memory/flash)
brne r0, 1, .Lother_bootup_chores ; u-boot didn't pass cmdline
breq r2, 0, .Lother_bootup_chores ; or cmdline is NULL
mov r5, @command_line
1:
ldb.ab r6, [r2, 1]
breq r6, 0, .Lother_bootup_chores
b.d 1b
stb.ab r6, [r5, 1]
#endif
.Lother_bootup_chores:
; Uboot - kernel ABI
; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
; r1 = magic number (board identity, unused as of now
; r2 = pointer to uboot provided cmdline or external DTB in mem
; These are handled later in setup_arch()
st r0, [@uboot_tag]
st r2, [@uboot_arg]
; Identify if running on ISS vs Silicon
; IDENTITY Reg [ 3 2 1 0 ]

View File

@ -29,7 +29,10 @@
int running_on_hw = 1; /* vs. on ISS */
char __initdata command_line[COMMAND_LINE_SIZE];
/* Part of U-boot ABI: see head.S */
int __initdata uboot_tag;
char __initdata *uboot_arg;
const struct machine_desc *machine_desc;
struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
@ -311,19 +314,31 @@ void setup_processor(void)
arc_chk_fpu();
}
static inline int is_kernel(unsigned long addr)
{
if (addr >= (unsigned long)_stext && addr <= (unsigned long)_end)
return 1;
return 0;
}
void __init setup_arch(char **cmdline_p)
{
/* This also populates @boot_command_line from /bootargs */
machine_desc = setup_machine_fdt(__dtb_start);
if (!machine_desc)
panic("Embedded DT invalid\n");
machine_desc = setup_machine_fdt(__dtb_start);
if (!machine_desc)
panic("Embedded DT invalid\n");
/* Append any u-boot provided cmdline */
#ifdef CONFIG_CMDLINE_UBOOT
/* Add a whitespace seperator between the 2 cmdlines */
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE);
#endif
/*
* Append uboot cmdline to embedded DT cmdline.
* setup_machine_fdt() would have populated @boot_command_line
*/
if (uboot_tag == 1) {
BUG_ON(is_kernel(unsigned long)uboot_arg);
/* Ensure a whitespace between the 2 cmdlines */
strlcat(boot_command_line, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, uboot_arg,
COMMAND_LINE_SIZE);
}
/* Save unparsed command line copy for /proc/cmdline */
*cmdline_p = boot_command_line;