All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] common: command: Fix manual relocation for repeatable command
@ 2019-10-21 14:25 Michal Simek
  2019-10-24 11:35 ` Michal Simek
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Simek @ 2019-10-21 14:25 UTC (permalink / raw)
  To: u-boot

All platforms which are using MANUAL_RELOC are jumping back to origin
location when repeatable command is called. The reason is that cmd_rep link
is not updated properly. Issue can be reproduced by rewriting origin
U-Boot location through (for example) file download by tftp command.

Fixes: 80a48dd47e3b ("common: command: Rework the 'cmd is repeatable' logic")
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 common/command.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/common/command.c b/common/command.c
index 4b887a267fb6..ceca99251076 100644
--- a/common/command.c
+++ b/common/command.c
@@ -496,6 +496,11 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
 	for (i = 0; i < size; i++) {
 		ulong addr;
 
+		addr = (ulong)(cmdtp->cmd_rep) + gd->reloc_off;
+		cmdtp->cmd_rep =
+			(int (*)(struct cmd_tbl_s *, int, int,
+				 char * const [], int *))addr;
+
 		addr = (ulong)(cmdtp->cmd) + gd->reloc_off;
 #ifdef DEBUG_COMMANDS
 		printf("Command \"%s\": 0x%08lx => 0x%08lx\n",
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] [PATCH] common: command: Fix manual relocation for repeatable command
  2019-10-21 14:25 [U-Boot] [PATCH] common: command: Fix manual relocation for repeatable command Michal Simek
@ 2019-10-24 11:35 ` Michal Simek
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Simek @ 2019-10-24 11:35 UTC (permalink / raw)
  To: u-boot

po 21. 10. 2019 v 16:25 odesílatel Michal Simek
<michal.simek@xilinx.com> napsal:
>
> All platforms which are using MANUAL_RELOC are jumping back to origin
> location when repeatable command is called. The reason is that cmd_rep link
> is not updated properly. Issue can be reproduced by rewriting origin
> U-Boot location through (for example) file download by tftp command.
>
> Fixes: 80a48dd47e3b ("common: command: Rework the 'cmd is repeatable' logic")
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  common/command.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/common/command.c b/common/command.c
> index 4b887a267fb6..ceca99251076 100644
> --- a/common/command.c
> +++ b/common/command.c
> @@ -496,6 +496,11 @@ void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
>         for (i = 0; i < size; i++) {
>                 ulong addr;
>
> +               addr = (ulong)(cmdtp->cmd_rep) + gd->reloc_off;
> +               cmdtp->cmd_rep =
> +                       (int (*)(struct cmd_tbl_s *, int, int,
> +                                char * const [], int *))addr;
> +
>                 addr = (ulong)(cmdtp->cmd) + gd->reloc_off;
>  #ifdef DEBUG_COMMANDS
>                 printf("Command \"%s\": 0x%08lx => 0x%08lx\n",
> --
> 2.17.1
>

Queue for rc1 because this is big issue which should be fixed ASAP and
only MB and m68k are affected by this patch.

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-24 11:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-21 14:25 [U-Boot] [PATCH] common: command: Fix manual relocation for repeatable command Michal Simek
2019-10-24 11:35 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.