提交 59ed9413 编写于 作者: V Vineet Gupta

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: NVineet Gupta <vgupta@synopsys.com>
上级 d8e8c7dd
...@@ -409,17 +409,6 @@ config ARC_DBG_TLB_MISS_COUNT ...@@ -409,17 +409,6 @@ config ARC_DBG_TLB_MISS_COUNT
Counts number of I and D TLB Misses and exports them via Debugfs Counts number of I and D TLB Misses and exports them via Debugfs
The counters can be cleared via Debugfs as well 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 config ARC_BUILTIN_DTB_NAME
string "Built in DTB" string "Built in DTB"
help help
......
...@@ -49,25 +49,13 @@ stext: ...@@ -49,25 +49,13 @@ stext:
st.ab 0, [r5,4] st.ab 0, [r5,4]
brlt r5, r6, 1b brlt r5, r6, 1b
#ifdef CONFIG_CMDLINE_UBOOT ; Uboot - kernel ABI
; support for bootloader provided cmdline ; r0 = [0] No uboot interaction, [1] cmdline in r2, [2] DTB in r2
; If cmdline passed by u-boot, then ; r1 = magic number (board identity, unused as of now
; r0 = 1 (because ATAGS parsing, now retired, used to use 0) ; r2 = pointer to uboot provided cmdline or external DTB in mem
; r1 = magic number (board identity) ; These are handled later in setup_arch()
; r2 = addr of cmdline string (somewhere in memory/flash) st r0, [@uboot_tag]
st r2, [@uboot_arg]
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:
; Identify if running on ISS vs Silicon ; Identify if running on ISS vs Silicon
; IDENTITY Reg [ 3 2 1 0 ] ; IDENTITY Reg [ 3 2 1 0 ]
......
...@@ -29,7 +29,10 @@ ...@@ -29,7 +29,10 @@
int running_on_hw = 1; /* vs. on ISS */ 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; const struct machine_desc *machine_desc;
struct task_struct *_current_task[NR_CPUS]; /* For stack switching */ struct task_struct *_current_task[NR_CPUS]; /* For stack switching */
...@@ -311,19 +314,31 @@ void setup_processor(void) ...@@ -311,19 +314,31 @@ void setup_processor(void)
arc_chk_fpu(); 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) void __init setup_arch(char **cmdline_p)
{ {
/* This also populates @boot_command_line from /bootargs */
machine_desc = setup_machine_fdt(__dtb_start); machine_desc = setup_machine_fdt(__dtb_start);
if (!machine_desc) if (!machine_desc)
panic("Embedded DT invalid\n"); panic("Embedded DT invalid\n");
/* Append any u-boot provided cmdline */ /*
#ifdef CONFIG_CMDLINE_UBOOT * Append uboot cmdline to embedded DT cmdline.
/* Add a whitespace seperator between the 2 cmdlines */ * 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, " ", COMMAND_LINE_SIZE);
strlcat(boot_command_line, command_line, COMMAND_LINE_SIZE); strlcat(boot_command_line, uboot_arg,
#endif COMMAND_LINE_SIZE);
}
/* Save unparsed command line copy for /proc/cmdline */ /* Save unparsed command line copy for /proc/cmdline */
*cmdline_p = boot_command_line; *cmdline_p = boot_command_line;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册