From patchwork Mon Oct 21 14:25:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1180649 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="a4oimE8V"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46xf7F2zllz9sNw for ; Tue, 22 Oct 2019 01:25:29 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id BD8D5C21C50; Mon, 21 Oct 2019 14:25:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0AFA1C21D56; Mon, 21 Oct 2019 14:25:21 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E3DDBC21D56; Mon, 21 Oct 2019 14:25:19 +0000 (UTC) Received: from mail-wr1-f68.google.com (mail-wr1-f68.google.com [209.85.221.68]) by lists.denx.de (Postfix) with ESMTPS id 8A44EC21C50 for ; Mon, 21 Oct 2019 14:25:19 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id q13so9263004wrs.12 for ; Mon, 21 Oct 2019 07:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id; bh=1fWQJttX7c28sVDq9SWnyIxKWVL6SDEZLIJuZJBUCi0=; b=a4oimE8VetFp7sSO0mgimVw55Pl55TgKeHdTNZ8dRo5zy4VAt/5jA2KwHc75UCxqJ1 H8loWWvxu38ETFheVDjToMuUuFDEK3bJyMAdP2mGTRm0uAbYvSh/3iynhBoE72H3u0bn eBm/ocKtYCwelMFPSnp8Mm7/JJxuJJQQLQfR+dL9hsXBIqkYH3jzhl0oPAQSSdDywqAt SA+/quc9T5p7owUHR07RtC1oVag6Y+nPay2hSPZ7ee7VKbbD3p18Mir/GfZCu0/rC1Bd 2ofWrSZFc0rxvQpbwyZfr5aT95+t70kpS8RXP7qkTCg2iH4xMUe3x3JNklXDRRZBxhkC ZSew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id; bh=1fWQJttX7c28sVDq9SWnyIxKWVL6SDEZLIJuZJBUCi0=; b=lrbUJN7ROvR7otNpSEKgOTT1tP3CflsMVhIfMm/KydtV4mZyBi341AmnpYtGeiRmNi G8+v3LytE9j6kAMWVLn/m7dXbFebArOh7ulgVj74tbPwyAM/cPTeEsRrWdXJg3eKIsgv VSamLCGZ1ITVB6yJC5whIKvy/UDMAIJKZajvoAql70RsYDw3XVxM8HPekm4qkoW0Ra3z A9ign9iesw0aMc5f5mgJoHucvwSWeKkXqv4Xvzatz2uC+3yJXBxVmRs69Pii2MjdQSGE P4NEP3otiMIonjt6kEc8QQeDVMBkaGsTZ0K9eniv51n4XLBD5iHpaEuap2m/rMxlkBks 8ZIw== X-Gm-Message-State: APjAAAWyPldxTAPIYyMO3dKMd5KCJap7v/Mqd4fBv01GtVWIZ52Ndivk r34REA75McmYib6mHBZ/tJH7Kb7RtZuTNw== X-Google-Smtp-Source: APXvYqxvpUK92yFMDyrVH2K0Rkpb61wzeey3aSGABRxcW6m/XpuHtRRuAE6y/nxzboyLhR3xNlJvwA== X-Received: by 2002:adf:ef4f:: with SMTP id c15mr20632721wrp.296.1571667918812; Mon, 21 Oct 2019 07:25:18 -0700 (PDT) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id w17sm16088385wra.34.2019.10.21.07.25.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 21 Oct 2019 07:25:18 -0700 (PDT) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Date: Mon, 21 Oct 2019 16:25:08 +0200 Message-Id: <846f155a185eded109959316b8e4c0e43a710b41.1571667905.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.17.1 Cc: Marek Vasut , Boris Brezillon , Christoph Muellner Subject: [U-Boot] [PATCH] common: command: Fix manual relocation for repeatable command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "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 --- 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",