From patchwork Sun Mar 31 02:08:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071586 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Zy07iTbp"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XCfW6fWSz9sQt for ; Sun, 31 Mar 2019 22:19:13 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 7A1DCC21E70; Sun, 31 Mar 2019 11:19:04 +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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 85B0DC21C2C; Sun, 31 Mar 2019 11:19:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 13BB2C21C2C; Sun, 31 Mar 2019 02:09:29 +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 38148C21C27 for ; Sun, 31 Mar 2019 02:09:28 +0000 (UTC) Received: by mail-wr1-f68.google.com with SMTP id y7so7264664wrn.11 for ; Sat, 30 Mar 2019 19:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbwamNxO1Op+o9tCPLGjiRMv+505m8jtH8Q7yzIswHM=; b=Zy07iTbpgVr5cQ02ffCnrZjOzguwSyeDMAiN5WKMgdKQRtyiqRRnibMXFJ5pxuwsYr nefUwCcpI2XzEi6vpf8tfR9LecTpQf6xS+earz7fTVxRNm1kTgps1PaYzXTYK2wlWv0W VyZgn/mTu7FUOKW8eYyUYID2VUo7JOz/p9CUDtidbNRHWNeAoQw6uWd+fsMkE07lln5x Zo6xq2iKEACZjWuKJRIzy1e+kpH+NlTf6VhPlswp+rj42cigqH9332NhMWtMRwbacHkn xV0aXSN7ihsmO4WBxW4BfNLpoJsrkLZ6EakycYrYQh27n4dfJkBABK4vyydL9K8H8mw9 9ppg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbwamNxO1Op+o9tCPLGjiRMv+505m8jtH8Q7yzIswHM=; b=HtE/w1TkCRCNicFBq2jAq0Vd9gPjVjokJih621ydtxJe6lJTakyEIRg5XX1JOm6J/g cZWbZpprAg91InqEGMRd2aJKdmaPSpAd+OuqE/PcvW8b6cuV9tolcFJT87wAt6LHYGLg hmGz0SdbVrHG26BwsiyWIKKbpx6xAJy1rbOqWtICsGvGYm+QCdx5epGwUuAHcT61kJwg gvOBv15WvQ6i+nfey6go1d9AknuBMJHD4Ep0tM3k+rB0dcpB3+M7rOReuefeHlEfM6M3 OmCE4EwB0NGyeWU2J+FnJLOPhcuN1YMCikB3myH44qKa3BjcEEauL1IQ6SlqsGzlTW1/ 5Bcg== X-Gm-Message-State: APjAAAXR6m5bmkjN+xwYJIGQbwR+2zNhZlmuDxtoNuDW3H3Zg/Iz+NMm l3ZF6H0bQS3tK+Mo55hVNec= X-Google-Smtp-Source: APXvYqx7Fbo6TYUZGhS7fHitXSOgrChHEswELx0sbEj9v+7bY/+4Vo840cJXLE/rxCjqsg65EwOkrw== X-Received: by 2002:a5d:488d:: with SMTP id g13mr23041565wrq.119.1553998167755; Sat, 30 Mar 2019 19:09:27 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.09.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:09:27 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:33 +0200 Message-Id: <20190331020838.26683-1-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 1/6] fdt: boot_get_fdt: remove redundant zeroing out 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Paranoid programming [1] lies at the foundation of proper software development, but the repetitive zeroint-out of output arguments in the context of the same function rather clutters the code and inhibits further refactoring/optimization than is doing any good. In boot_get_fdt(), we already perform zero/NULL-initialization of *of_flat_tree and *of_size at the beginning of the function, so doing the same at function error-out is redundant/superfluous. Moreover, keeping the code unchanged might encourage the developers to update *of_flat_tree and *of_size during some interim computations, which is against the current design of boot_get_fdt(). Currently, writing useful data into these arguments happens just before successfully returning from boot_get_fdt() and it should better stay so. [1] https://blog.regehr.org/archives/1106 Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 01186aeac7a4..1817ce6bce30 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -489,8 +489,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, no_fdt: ok_no_fdt = 1; error: - *of_flat_tree = NULL; - *of_size = 0; if (!select && ok_no_fdt) { debug("Continuing to boot without FDT\n"); return 0; From patchwork Sun Mar 31 02:08:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071587 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="UHnacoMS"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XCgj3HDZz9sQt for ; Sun, 31 Mar 2019 22:20:17 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 1BC65C21E12; Sun, 31 Mar 2019 11:19:18 +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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 CCD75C21D83; Sun, 31 Mar 2019 11:19:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B6F93C21C2C; Sun, 31 Mar 2019 02:09:38 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id AC540C21C27 for ; Sun, 31 Mar 2019 02:09:37 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id t17so7256469wrw.13 for ; Sat, 30 Mar 2019 19:09:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=afPIqgh7pKdtp/qaGkm5xPJpXhKLdf8hsF7TB3JA0as=; b=UHnacoMSq+12n8rfifNpJ+Rvfpp0s6duP0dP21Vbllq9LzXatSVUfmhEO1FRZJoNhH C0aK7Mf4vOslx6akus9/Am1Gq1PHtwxcEjXL/a9cElKZKn5c+igPRAhu+UXieq7v/nq4 nmzKkA7RGkONT9LdvZel6CL2BkDm51vXZvgNj9cHaG63YbKY3EfZa+aGPmfqAc1+HQLH mGcUJW/ZVKM3YjgEHaAnnDMty5V/jTma9/g7sNKZgrp/PMRqDRg9g1X4rwE5HTOHsjMf kBKXB/wIMWzMT1DNowlgoZFfNVQ/OETTR8L79bWmFY2GhKvuwSJOf1J6UvQsHuWn2+qw AbYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=afPIqgh7pKdtp/qaGkm5xPJpXhKLdf8hsF7TB3JA0as=; b=eQc+7Q5v4WLKe/DpgHD3PoKDCe8EJ68f07x+m3bl4FuH/WvClq+ZIo9UBsoRDfzCpi 0+7OmQM/9ytjubLAOUCywHjuQVu6lGGLNLqInYfmZoFXoJG+pVX74nZDzUfgmpgzOfDN /tkkQXveRnSwOyhkkLmz3xCvoqWJOtT859/q7f5HRBUBtpSuiqwARXwmy+Og2yitAQ87 zF6Yg9HQGFZbO+fjuCv34M6n9kS1K5vviEVzoBZU2RF1Wi8gv6JG7kFhIxoZ1WF7Wp15 BwTI13VS5KiCTv/+9oJ8nrPAcavdY5Yrd9maiVG5Z4WjrigwIA9bhrXebVL1+ZLIEzkC UwIw== X-Gm-Message-State: APjAAAXQNSPXypP4f9kIWwG3vG3Nhz2u14+rTFk83aDRx4n/qGSyv3jg Y4lLNgGwgv6lZsOQybJvPfs= X-Google-Smtp-Source: APXvYqz4It+1IXiMxSe01L/CpxiO7/KI5QZol7Hd8X7D1AL/ySFtK7pziCoVWx0h/MNGUn9OvXVWuQ== X-Received: by 2002:a5d:424b:: with SMTP id s11mr3149654wrr.158.1553998177353; Sat, 30 Mar 2019 19:09:37 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:09:36 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:34 +0200 Message-Id: <20190331020838.26683-2-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331020838.26683-1-erosca@de.adit-jv.com> References: <20190331020838.26683-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 2/6] fdt: boot_get_fdt: really boot w/o FDT when "goto no_fdt" 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The 'no_fdt' goto label was introduced by v2015.01 commit [0] and it had two review stages [1-2]. The *documented* purpose behind commit [0] is (excerpt from commit description): > allows both FDT and non-FDT kernels to boot by making the > third parameter to the bootm/bootz optional While [1] and [2] share the same goal, they have very different implementations: - [1] was based on a very simple 'argc' check at function error out with returning success to the caller if the third parameter was NOT passed to bootm/bootz command. This approach had the downside of returning success to the caller even in case of legitimate internal errors, which should halt booting. - [2] added the "no_fdt" label and several "goto no_fdt" statements. This allowed to report the legitimate internal errors to the caller. IOW the major difference between [1] and [2] is: - [1] boot w/o FDT if FDT address is not passed to boot{m,z,*} - [2] give *freedom* to the developer to boot w/o FDT from any (more or less) arbitrary point in the function flow (and here comes the peculiar aspect, which looks to be a leftover from [1]) with the precondition that the 3rd argument (FDT address) is NOT provided to boot{m,z,*}. In practice, this means that only a subset of "goto no_fdt" end up booting w/o FDT while the other subset is returning an error to the caller. This patch removes the peculiar behavior described above, such that "goto no_fdt" performs really what it tells to the developer. The motivation of this patch is to decrease the unneeded complexity and increase the readability of boot_get_fdt(). [0] 48aead71c1ad ("fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined") [1] https://patchwork.ozlabs.org/patch/412923/ ("[U-Boot,v1] fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined") [2] https://patchwork.ozlabs.org/patch/415635/ ("[U-Boot,v2] fdt: Allow non-FDT kernels to boot when CONFIG_OF_LIBFDT is defined") Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 1817ce6bce30..c335e7e2f220 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -489,7 +489,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, no_fdt: ok_no_fdt = 1; error: - if (!select && ok_no_fdt) { + if (ok_no_fdt) { debug("Continuing to boot without FDT\n"); return 0; } From patchwork Sun Mar 31 02:08:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071588 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="t6ZlO9qb"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XCgl4qSfz9sQt for ; Sun, 31 Mar 2019 22:20:19 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 61D44C21E2C; Sun, 31 Mar 2019 11:19:31 +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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 18220C21DD9; Sun, 31 Mar 2019 11:19:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 697EAC21C2C; Sun, 31 Mar 2019 02:09:51 +0000 (UTC) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by lists.denx.de (Postfix) with ESMTPS id 1D43BC21C27 for ; Sun, 31 Mar 2019 02:09:51 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id k17so7273938wrx.10 for ; Sat, 30 Mar 2019 19:09:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=luZCoBcB/k1M3LhkpryYV54EXgECmkQhxg/q1G97MUc=; b=t6ZlO9qbD0nWTHnBoU6xOHEGIu51qrHJpedmO+ZAE3+ShXa10WSQFpk5yUqALpXD6a 01x1Ul+XCRrucYEaLdyzpxs0/EOXBw8BmjR7HCZJg/cDoo37x3JKeV2KUD9vCHqDFIBN 3gJLr6JxB8y7xxYo5v8/X4pYaXJfLzw2txM9K48lmORLhs/CSzBSrOsAXJCd6uHZuZfl p6Nc75AgPuumPFc+Qt9fFMtq9YhAgBS6XfuP+T+XFf5kM1aQso2/gnf61jHIYK90sPU7 kkR1C9upG47EEnFpwY/vkWAcqNVTeFgcc31J15Tfh4AQ2bBix0VFu9Sn7hdPFN90Culv 3Xiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=luZCoBcB/k1M3LhkpryYV54EXgECmkQhxg/q1G97MUc=; b=gZOt3tfMXCR57EsaO10fQFmRE1PfOgBqF0wcyMdYA0iC1l69Sx9ZHBZmfDPPVDrPl6 HtWaD7siiZg6V/2E/MGP0Ra1bbjFCTFTjY5R4hlcHkvTKvUE7SWCqJOPiOFcwQXj667Z EpMHeWRh5l+saao4LURzJwgXIvH+MmKyGrr7u14IO+c57MnOTzgmNzfu0/raty5gztHY Zv20KQThVTQNahq4MOzmw/Yggd4h79J4eEZxT4FKsGA/b8ZYt+7Rus8UPARhyT+bNBe/ 2ExYJIA8E1HHdRJZ9DF0XsRbhqmzm/tpD83fsrWigGXlSrWD/nV5TcEZzWy3z0wSmjuE 7oNA== X-Gm-Message-State: APjAAAWvkBLqlrI3gWK/U0W6s8LKVJNQz0WyvrcBHnxTTcC7Uxk6Aeo+ h09eDinJAVKAU4HVAY4eesY= X-Google-Smtp-Source: APXvYqwJWeL/FIgQ1RSBaTQyjL9e1psPy2zuSWRcBsmolC0L4x39wrkexnckwdtp8qfUzEEiT6HYYQ== X-Received: by 2002:adf:ea43:: with SMTP id j3mr34397327wrn.210.1553998190782; Sat, 30 Mar 2019 19:09:50 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.09.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:09:50 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:35 +0200 Message-Id: <20190331020838.26683-3-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331020838.26683-1-erosca@de.adit-jv.com> References: <20190331020838.26683-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 3/6] fdt: boot_get_fdt: simplify no_fdt handling (non-functional) 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Increase the readability of boot_get_fdt(). No change in behavior is expected. Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index c335e7e2f220..68bcab85baf4 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -279,7 +279,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, int fdt_noffset; #endif const char *select = NULL; - int ok_no_fdt = 0; *of_flat_tree = NULL; *of_size = 0; @@ -487,12 +486,9 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, return 0; no_fdt: - ok_no_fdt = 1; + debug("Continuing to boot without FDT\n"); + return 0; error: - if (ok_no_fdt) { - debug("Continuing to boot without FDT\n"); - return 0; - } return 1; } From patchwork Sun Mar 31 02:08:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071589 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="XlL9fBi6"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XChk00qfz9sQt for ; Sun, 31 Mar 2019 22:21:09 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id AA3F7C21C27; Sun, 31 Mar 2019 11:19: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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 71166C21E15; Sun, 31 Mar 2019 11:19:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D096EC21C2C; Sun, 31 Mar 2019 02:09:59 +0000 (UTC) Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by lists.denx.de (Postfix) with ESMTPS id 852DCC21C27 for ; Sun, 31 Mar 2019 02:09:59 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id y7so7265294wrn.11 for ; Sat, 30 Mar 2019 19:09:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E/eA1WvQRsbof+60trFmhcRmg/1pEj8dhfAXMY5hhUQ=; b=XlL9fBi6qMiozEPzNEp9/4i1EnsC1XyLES23jFFGd1FMS+CEFLJQtpSwP3t+haNpzS nJ6uZwaSjrDkyZI3V1oKK0rqKEQqvkj2anzBLIHRvZYzmtKycNGzrGpHLHZa464rWbZu 3kzxeFLir15oT5rPzz5MmHIaSE6LHO6Mgu/koai36V/5VG/bBHYO36tI1k+0KAdHv/kY FHugkF9sxU1Cnr2HMvK5/iXbnmGTv+Q1P+0spqGy72tBoR15GEWIK3XI071MgIFOHaYz othY4e/8a9DvO4/5y0zr7LlAkC9gFMqj+MPheKBXI/eTxtTb5ORzwezooFdEPP3CLZjr 0j2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E/eA1WvQRsbof+60trFmhcRmg/1pEj8dhfAXMY5hhUQ=; b=VeYBFC3YUb2X6oAuF/PWVGKErhaeFaDdVc3Mw3ZNVnvUaf0f6xgIDEyUl0YsEnN69q be1+nuhA5JhCsIFHvPcJSijCm7K9v4NYi69T0T4qLs41rcfjn5WagayXExtDGLZ6BcpR ueuwn0ybY7DXqujYQn06RgdneDS/XcSiqP7lUTjFiTr7eE7hqQq+TvR1k13bDnX4JAzf SFp14MarOz6TcGYJGubOpCB893SMVvZcaCpsMwkMyFiz70x2IoedoX+tL/eFSgL+ezQj O5M3QqmymMZhoMZS6Sdtx0jvzl9IoHv7xPEzuwK09NWjfR7mcHW1D9BlyFjLt3ODQdPB EUsQ== X-Gm-Message-State: APjAAAXfdx9kIuH5YNsLbyh863V76FOHF7ijJslHbx5KF24doXO6j/H3 HVgtAS4LumsEG6t6L1NHH1o= X-Google-Smtp-Source: APXvYqzAElf6/30Fb3U1t2aarKGq8TGTRPvh0rIrUVQwVh8ADlQtPQSrvSbhSfwHgnLz7WQT4DYTcg== X-Received: by 2002:adf:cc85:: with SMTP id p5mr14951716wrj.101.1553998199180; Sat, 30 Mar 2019 19:09:59 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.09.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:09:58 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:36 +0200 Message-Id: <20190331020838.26683-4-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331020838.26683-1-erosca@de.adit-jv.com> References: <20190331020838.26683-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 4/6] fdt: boot_get_fdt: unify 'fdt_len' validation (non-functional) 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Currently, there are two helpers called to determine the length of FDT blobs embedded in the U-Boot-supported images: - image_multi_getimg(.., &fdt_len) - android_image_get_second(.., &fdt_len) The returned 'fdt_len' value must match 'fdt_totalsize(fdt_blob)'. Reduce the duplicated code by uniying the two checks. No functional change is expected except that the error message 'fdt size != image size' will appear as a more generic 'fdt size mismatch!' to cover both use-cases. Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 68bcab85baf4..250f99aaaedd 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -270,6 +270,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, #endif ulong img_addr; ulong fdt_addr; + ulong fdt_len = 0; char *fdt_blob = NULL; void *buf; #if CONFIG_IS_ENABLED(FIT) @@ -428,7 +429,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, } else if (images->legacy_hdr_valid && image_check_type(&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) { - ulong fdt_data, fdt_len; + ulong fdt_data; /* * Now check if we have a legacy multi-component image, @@ -447,11 +448,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, fdt_error("image is not a fdt"); goto error; } - - if (fdt_totalsize(fdt_blob) != fdt_len) { - fdt_error("fdt size != image size"); - goto error; - } } else { debug("## No Flattened Device Tree\n"); goto no_fdt; @@ -459,7 +455,7 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, #ifdef CONFIG_ANDROID_BOOT_IMAGE } else if (genimg_get_format(buf) == IMAGE_FORMAT_ANDROID) { struct andr_img_hdr *hdr = buf; - ulong fdt_data, fdt_len; + ulong fdt_data; if (android_image_get_second(hdr, &fdt_data, &fdt_len) != 0) goto no_fdt; @@ -468,9 +464,6 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, if (fdt_check_header(fdt_blob) != 0) goto no_fdt; - if (fdt_totalsize(fdt_blob) != fdt_len) - goto error; - debug("## Using FDT found in Android image second area\n"); #endif } else { @@ -478,6 +471,11 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, goto no_fdt; } + if (fdt_totalsize(fdt_blob) != fdt_len) { + fdt_error("fdt size mismatch!"); + goto error; + } + *of_flat_tree = fdt_blob; *of_size = fdt_totalsize(fdt_blob); debug(" of_flat_tree at 0x%08lx size 0x%08lx\n", From patchwork Sun Mar 31 02:08:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071590 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="X5a2mrfg"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XChw32pRz9sQt for ; Sun, 31 Mar 2019 22:21:20 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 14ED3C21C27; Sun, 31 Mar 2019 11:19:58 +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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 12833C21E2B; Sun, 31 Mar 2019 11:19:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9838CC21C2C; Sun, 31 Mar 2019 02:10:07 +0000 (UTC) Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by lists.denx.de (Postfix) with ESMTPS id 503D0C21C27 for ; Sun, 31 Mar 2019 02:10:07 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id h18so7148627wml.1 for ; Sat, 30 Mar 2019 19:10:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WUgierElifp3thAukSaGTeI4TI0s3cZeLzDaDdlgid0=; b=X5a2mrfgsIwHfO4cJKz278oqddHDvHo8pq8vj1301WKW8C68/mNA8SIURbqlFQikGz wKtBxWoGOyVi2ht9Ms+/FK0di0VUK5VG5vIxg0X0Gbz+Jv/K93BvffP9UX9np6fGffKq vbtvIyM98tBwvfFh7up7tcL6b9vvKxLl28Q1YDCfZpCYePl3rGIfXMFhHWIjSai4gRT/ nFxJdfBycV+V5rt+e7MiocjwOf+UdFpSQa1wYE2b2/9qszj1nDdOB11MNgoOC9/w7jsJ kIfsfYNp7sO9Sz4y0TmsVOWzaSrcz4kF//JpnBcEvzpmDaooEZlNQ171EJHhhTsdI6XT iatA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WUgierElifp3thAukSaGTeI4TI0s3cZeLzDaDdlgid0=; b=Wr97jLr+cjQkHg6gCfHXbCFJuovldcIM8lRGnlMGNTVGWa3PGsIS0XwykcYhUmFf9e U1VctqlIXezqN7sFQDdbkF5UHgwEPynIgAUEuyVGWcl7Qcd/3lI/IP2bIwnuPvM2gPeY Zc4Or/Dl/HI/ze0PKJhDVQQT6SyczukC+2iGAw4zaPkFUpfb28U1i4yvg4jZOlN2x1rE DBOMGZTLcneObgBa1S/PGa292RsXyFAjruW9hAgKD/Y8G85/lCLZVBHUKTSIL7o2pL/+ Q0kf5A9hoJHfvMDzEV2+6ikY/M45TjUrwZ8l2Hg6iJkxjcROf20V0Vi+4sWjihZDFt2c Y3wQ== X-Gm-Message-State: APjAAAUzDEgTUuKYAwGMOCKJ2metLVTwaY3NFlzHTDLvdW9bu4nuWh+3 5O4KUA86sAysKK/AX1wof8Y= X-Google-Smtp-Source: APXvYqzamn3B646/i6Vf9kYBXDew5ozF1hr7ezkKfvIf42/7rfh1bVZ55TbYkdz/P64WRqBPwUwVBQ== X-Received: by 2002:a1c:a9d7:: with SMTP id s206mr8351809wme.126.1553998206882; Sat, 30 Mar 2019 19:10:06 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.10.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:10:06 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:37 +0200 Message-Id: <20190331020838.26683-5-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331020838.26683-1-erosca@de.adit-jv.com> References: <20190331020838.26683-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 5/6] fdt: boot_get_fdt: android: compress handling (non-functional) 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Prepare for booting Android images which lack any DTB in the second area using 'fdtaddr' environment variable as source/address of FDT. No functional/behavioral change expected in this patch. Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 250f99aaaedd..8fea54335e99 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -457,14 +457,13 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, struct andr_img_hdr *hdr = buf; ulong fdt_data; - if (android_image_get_second(hdr, &fdt_data, &fdt_len) != 0) - goto no_fdt; - - fdt_blob = (char *)fdt_data; - if (fdt_check_header(fdt_blob) != 0) + if (!android_image_get_second(hdr, &fdt_data, &fdt_len) && + !fdt_check_header((char *)fdt_data)) { + fdt_blob = (char *)fdt_data; + debug("## Using FDT in Android image second area\n"); + } else { goto no_fdt; - - debug("## Using FDT found in Android image second area\n"); + } #endif } else { debug("## No Flattened Device Tree\n"); From patchwork Sun Mar 31 02:08:38 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniu Rosca X-Patchwork-Id: 1071591 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) 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=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="VpqEa6M+"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44XCj45Zljz9sR0 for ; Sun, 31 Mar 2019 22:21:28 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 53F87C21E62; Sun, 31 Mar 2019 11:20:13 +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=FREEMAIL_FROM, KHOP_BIG_TO_CC, 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 88271C21E39; Sun, 31 Mar 2019 11:19:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 030ACC21C2C; Sun, 31 Mar 2019 02:10:13 +0000 (UTC) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by lists.denx.de (Postfix) with ESMTPS id A1D5AC21C27 for ; Sun, 31 Mar 2019 02:10:13 +0000 (UTC) Received: by mail-wm1-f67.google.com with SMTP id o25so6397837wmf.5 for ; Sat, 30 Mar 2019 19:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7b48nyiolu2PlpIt7YxYP7xDgtg+UVgR1S7kBnemLjY=; b=VpqEa6M+xYZ+m+yfCVPuUNNLA/7ZH8RcSgDraxzHLEWF1JpfbO2JFfF7nYXWGpJCRW l9u2L2a/3z9xZQqWTdOXgWf4keJ6AJVSKYNNDAxiBC6Spg4gPE69lbaI+5Za0LWBxicJ mTpccp8WImSlIYt74PAOrIu4LoMLh4XRWkorn99dgy6Wr+AQAYxA7gzvYJcbbk0n3onL a0IIgDj6+oCFvWEnZZtu6Si6zqIRAxznB1KKrvkjxiKak4yIR3jFFcQjkZEVoRg9VXAr vYWsGinCNWRQct6ieQsDoEB91OZlzt+hAUJZJk1ogMZ8tTJO1G6B/FDeZ+7hhRsWQCZN +pOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7b48nyiolu2PlpIt7YxYP7xDgtg+UVgR1S7kBnemLjY=; b=KPkIIiujfFmdF9Tz+y78AUQ8WHB0Zts/5E5djeA9KeDSJAo0O9Lb52RxXmNC/iIJvD tX6LbVkJv4bqOro5Imo9Ok3u9LTRXMBfJREXpzRGMAT8cUSiRIJcXPhrWPyagqjArg+m cGpd29Yt2jFURP6BgsO5JHS0WbHpUi2xP33PjMeh/lYF7PW6kthx2KnY8ufgNbekHxKN +Ks5/6ceoHN1eX7Qze3wDvD0GmZ/e0RhKY0BzIblTJKZJRpFgCaP4+72+CQ8iXY6nNcb JcODzO/fiVXMLU964qEgKsL1BgPACIjfJ6Unu1APLpT58nE6J4QVjixz2fcBQTGySNcv tb6Q== X-Gm-Message-State: APjAAAUJ6xOhU8ElP16oHTKzbtlTRHkS8TJUGF8y3FgZj1u140RZmIxX nTTIfWZIqLUKTIteHEB80AU= X-Google-Smtp-Source: APXvYqzIluEKGZM6hEAIeZydZ/ZmnU7OTRQjBUm3AAYQo3VytDiTdEzaam7gdb7XLYu9ZdgPBo+uJg== X-Received: by 2002:a7b:c304:: with SMTP id k4mr8606196wmj.22.1553998213250; Sat, 30 Mar 2019 19:10:13 -0700 (PDT) Received: from localhost.localdomain (ipb218f541.dynamic.kabel-deutschland.de. [178.24.245.65]) by smtp.gmail.com with ESMTPSA id e193sm10228733wmg.18.2019.03.30.19.10.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 30 Mar 2019 19:10:12 -0700 (PDT) From: Eugeniu Rosca X-Google-Original-From: Eugeniu Rosca To: Simon Glass , Tom Rini , Masahiro Yamada , Stefan Roese , Sam Protsenko , Simon Goldschmidt , Marek Vasut , George McCollister , Alexey Brodkin , Alexander Graf , York Sun , Tuomas Tynkkynen , Thomas Petazzoni , Shawn Guo , Paul Kocialkowski , Pantelis Antoniou , Michal Simek , Max Krummenacher , Marcel Ziswiler , Joe Hershberger , Joakim Tjernlund , Heiko Schocher , Hannes Schmelzer , Hannes Schmelzer , Daniel Schwierzeck , Bin Meng , u-boot@lists.denx.de Date: Sun, 31 Mar 2019 04:08:38 +0200 Message-Id: <20190331020838.26683-6-erosca@de.adit-jv.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190331020838.26683-1-erosca@de.adit-jv.com> References: <20190331020838.26683-1-erosca@de.adit-jv.com> MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 31 Mar 2019 11:19:00 +0000 Cc: Eugeniu Rosca , Eugeniu Rosca Subject: [U-Boot] [PATCH 6/6] fdt: boot_get_fdt: android: use ENV 'fdtaddr' as fallback 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: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Our platform doesn't store the DTB into the Android image second area, but rather copies the DTB to RAM from a dedicated dtb.img partition [0], prior to booting the Android image by calling bootm. Similar to [1], we find it useful to just call 'bootm' and have the right DTB being passed to OS (assuming its address has been previously stored in 'fdtaddr' by calling `fdt addr `). Booting Android with DTB from 'fdtaddr' will only occur if: - No DTB is embedded in the second area of Android image - 'fdtaddr' points to a valid DTB in RAM [0] https://source.android.com/devices/architecture/dto/partitions [1] https://patchwork.ozlabs.org/patch/1046652/ ("Support boot Android image without address on bootm command") Signed-off-by: Eugeniu Rosca --- common/image-fdt.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/image-fdt.c b/common/image-fdt.c index 8fea54335e99..3307c990672f 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -462,7 +462,16 @@ int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch, fdt_blob = (char *)fdt_data; debug("## Using FDT in Android image second area\n"); } else { - goto no_fdt; + fdt_addr = env_get_hex("fdtaddr", 0); + if (!fdt_addr) + goto no_fdt; + + fdt_blob = map_sysmem(fdt_addr, 0); + if (fdt_check_header(fdt_blob)) + goto no_fdt; + + fdt_len = fdt_totalsize(fdt_blob); + debug("## Using FDT at ${fdtaddr}=Ox%lx\n", fdt_addr); } #endif } else {