From patchwork Thu Apr 26 11:37:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 134508 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp2162961lji; Thu, 26 Apr 2018 04:37:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx48Yb2lYLmi/S7CZp6k3mAguDJ29cdHMzWEIenabicY+78tdm/eqce1XSNFAQsCR8bFDYEK6 X-Received: by 10.80.183.65 with SMTP id g59mr43534285ede.129.1524742668221; Thu, 26 Apr 2018 04:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524742668; cv=none; d=google.com; s=arc-20160816; b=M7qZTa6xujHLvUsZqr6drOvB/OmXbWQ52yl4jaE9T/Au34q330mqPtqO+AIWjUPxuu te7kVPKDlhbS7T8J3eO52q3iV8oXyqovxjwgG5+9lshN1BP8h4vJa0uqDj3TO5rQGung 4sVxykNPCnVpeGPKo/wC7hleh8rc0zO4F75qtuCgaZg7pbLp8c2ofUj4p2tt+9h5u/wF aANDnlTI5Ah4HnSWIVTyt77fuqVMoqXsLxxARcikejiNZm1E677DefaYV51eXQCiJ2W2 Afbvo/e5srbtxpMPzWZn3DaRWBO/8Ui38E5Gj9mLun2YkIxAKjn94WhFQoKa/O4MsY0l bwCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:message-id:date:to:from :arc-authentication-results; bh=JZoyHpzAjx0m7V9sYZfRKYVjbOvCIaXkMQCCejxVQvk=; b=qvr+fxpOfL13pxirVLmW2MX4XNivvZ6BfVuRfsM0QVm9zKS2MyS7JfwNjlndfSGW7a 2k3Z36KS/dD7RXj9H0ed7J1K90sS+HCWtD5LGzA/CR23z+Fg8d3hgCP6iHDL1XjXYXxq 5oUuCya7EgUwPyRJnVXeR2xgO0VXljs1EmB73Kdwgz7tDXnQvWrWrFWvGyQNV2IeJxHE roU1uJzMMtOFi5Q7Dqi0T1eskt4PXFMd1WbRrNE04SyT4AXWeqX4ODMG06ql9PUDghuZ cjKDZOVb89txwTVtSBb86OmyMPeYSGpx2FpS9KP3WNGPA22nsVctj03wd+Gx1dzkvAT/ dTyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id j5si5430661edd.95.2018.04.26.04.37.47; Thu, 26 Apr 2018 04:37:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 72434C22089; Thu, 26 Apr 2018 11:37:45 +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=none 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 5792EC21FF3; Thu, 26 Apr 2018 11:37:43 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 50134C22026; Thu, 26 Apr 2018 11:37:42 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id CE5BEC21FEC for ; Thu, 26 Apr 2018 11:37:41 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 23F67AAB4; Thu, 26 Apr 2018 11:37:41 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 26 Apr 2018 13:37:39 +0200 Message-Id: <20180426113739.45157-1-agraf@suse.de> X-Mailer: git-send-email 2.12.3 Cc: Michal Simek Subject: [U-Boot] [PATCH] tools: zynqmpbif: Add support for load=after 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" Some times it's handy to have a partition loaded immediately after the end of the previous blob. The most obvious example for this is a U-Boot binary (coming from .elf) and a device tree file. This patch adds that logic. With this, the following bif snippet does what you would expect: [destination_cpu=a5x-0, exception_level=el-2] u-boot.elf [load=after] u-boot.dtb converts to FSBL payload on CPU a5x-0 (PS): Offset : 0x00590500 Size : 577768 (0x8d0e8) bytes Load : 0x08000000 Attributes : EL2 Checksum : 0xefca2cad FSBL payload on CPU none (PS): Offset : 0x0061d640 Size : 129760 (0x1fae0) bytes Load : 0x0808d0e8 (entry=0x00000000) Attributes : EL3 Checksum : 0xf7dd3d49 Signed-off-by: Alexander Graf --- tools/zynqmpbif.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/zynqmpbif.c b/tools/zynqmpbif.c index 6c8f66055d..47c233c15f 100644 --- a/tools/zynqmpbif.c +++ b/tools/zynqmpbif.c @@ -42,6 +42,7 @@ enum bif_flag { BIF_FLAG_PUF_FILE, BIF_FLAG_AARCH32, BIF_FLAG_PART_OWNER_UBOOT, + BIF_FLAG_LOAD_AFTER, /* Internal flags */ BIF_FLAG_BIT_FILE, @@ -151,6 +152,11 @@ static char *parse_load(char *line, struct bif_entry *bf) { char *endptr; + if (!strncmp(line, "after", strlen("after"))) { + bf->flags |= (1ULL << BIF_FLAG_LOAD_AFTER); + return line + strlen("after"); + } + bf->load = strtoll(line, &endptr, 0); return endptr; @@ -336,6 +342,15 @@ static int bif_add_part(struct bif_entry *bf, const char *data, size_t len) if (r) return r; + if (bf->flags & (1ULL << BIF_FLAG_LOAD_AFTER) && + bif_output.last_part) { + struct partition_header *p = bif_output.last_part; + uint64_t load = le64_to_cpu(p->load_address); + + load += le32_to_cpu(p->len) * 4; + parthdr.load_address = cpu_to_le64(load); + } + parthdr.offset = cpu_to_le32(bf->offset / 4); if (bf->flags & (1ULL << BIF_FLAG_BOOTLOADER)) {