From patchwork Wed Jun 17 23:51:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Atish Patra X-Patchwork-Id: 1311690 X-Patchwork-Delegate: uboot@andestech.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=NOTT4QPr; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49nMLq06BDz9sRh for ; Thu, 18 Jun 2020 09:52:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3A1CD82053; Thu, 18 Jun 2020 01:52:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.b="NOTT4QPr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 95B9B82055; Thu, 18 Jun 2020 01:52:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from esa3.hgst.iphmx.com (esa3.hgst.iphmx.com [216.71.153.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id BA0AC82050 for ; Thu, 18 Jun 2020 01:51:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=wdc.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=prvs=4303c61a0=atish.patra@wdc.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1592437913; x=1623973913; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XSZMYyBzB97IQK64GTcnEI3nnJ4vS7SraswOkkRA+2Q=; b=NOTT4QPrnGlw7INA72DMaDTAJ0t1t1kEPpatghYvB84hLG3BS4G98TnW lFPFej7xxYhrcZjCZ1IVQIZEhqtXLsC0LN1GscTxb3uOw8MVW6htiObDo x0VtmZnqwMa5euR9gtxCWVXQNut+iL5LdEAgFO7VWVPqS3uEltmUVE1M2 nkz0Tza+lsk2YvSiN4a91l61GXYOKWumXdmeOEeiJBzC6GP0IUNcEC43a KRmVBQkoi4ChewSqOEiPTzXoA4PfVGB2MBZv90TWOsZBBn/qfmtQBM+kC dtv0RgxnCGaVvlMwGkMNEs8ieteIFGCGQCVrW8zNOGe13dUzZuy7+dexZ Q==; IronPort-SDR: 6YRJqHA9XJso8OulkHlURxOezmlfSXp+Q+x4wHohI66avhMM1SDp5/+99nQFFMdD7Kd8iA6Mvw vt5rLKSrbiD9x6ltzoD3WkNc6pJEHPks3boIVjdGTsWqiO9KAjiQ6Z3QY3bgTjqnvFWDVG76zp a0BxRCNYkfv56ccXocpy+DGCOYf4oCpmfiFsAujJWx89ajJYIGD/nHI/VwrdcLtHob9JvL8ibC Ip+qHOTz4ie3rhmt/zMGDGDyE12TUupm1db+uiVefjYz2laFE51zaus9jBHjyomJB7kiceylIC k2E= X-IronPort-AV: E=Sophos;i="5.73,524,1583164800"; d="scan'208";a="144587782" Received: from h199-255-45-15.hgst.com (HELO uls-op-cesaep02.wdc.com) ([199.255.45.15]) by ob1.hgst.iphmx.com with ESMTP; 18 Jun 2020 07:51:36 +0800 IronPort-SDR: jqDibg+dj+uHk6fsAk1TNj5oHBSyJUFHRdvpN1WuNP8w3+HZdOaVhMD2x2whEr0UdLQdxGqTVz LMYZIpqcE0DfMRMw5lypXWc+lPSzzjzi8= Received: from uls-op-cesaip02.wdc.com ([10.248.3.37]) by uls-op-cesaep02.wdc.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 16:40:16 -0700 IronPort-SDR: f93wRh5P1hZPhbvbM+eJqFfQ+08yGhb9IRiQq3FOLs5KUiPSGiMYh9nzcoLQFa5r1lARo+PeHt KuHLfVGGYeGA== WDCIronportException: Internal Received: from usa003000.ad.shared (HELO jedi-01.hgst.com) ([10.86.58.137]) by uls-op-cesaip02.wdc.com with ESMTP; 17 Jun 2020 16:51:35 -0700 From: Atish Patra To: u-boot@lists.denx.de Cc: Atish Patra , Anup Patel , Bin Meng , Heinrich Schuchardt , Jagan Teki , Marek Vasut , Simon Goldschmidt , David Abdurachmanov , Tom Rini Subject: [PATCH 1/2] riscv: Use correct version of fdtdec_get_addr_size Date: Wed, 17 Jun 2020 16:51:30 -0700 Message-Id: <20200617235131.21374-1-atish.patra@wdc.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 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" X-Virus-Scanned: clamav-milter 0.102.2 at phobos.denx.de X-Virus-Status: Clean fdtdec_get_addr_size uses a fixed value for address_cells & size_cells which may not work correctly always. fdtdec_get_addr_size_no_parent will automatically calculate the cell sizes from parent but not optimized especially when parent node is already available with the caller. Use fdtdec_get_addr_size_auto_parent that automatically calculate the cell sizes and optimized for the given usecase. Signed-off-by: Atish Patra --- arch/riscv/lib/fdt_fixup.c | 2 +- lib/fdtdec.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c index 6db48ad04a56..f2ec37b57b15 100644 --- a/arch/riscv/lib/fdt_fixup.c +++ b/arch/riscv/lib/fdt_fixup.c @@ -44,7 +44,7 @@ int riscv_fdt_copy_resv_mem_node(const void *src, void *dst) fdt_for_each_subnode(node, src, offset) { name = fdt_get_name(src, node, NULL); - addr = fdtdec_get_addr_size_auto_noparent(src, node, + addr = fdtdec_get_addr_size_auto_parent(src, offset, node, "reg", 0, &size, false); if (addr == FDT_ADDR_T_NONE) { diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 1f2b763acc31..b62eb142ccc3 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1296,7 +1296,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename, const char *name = fdt_get_name(blob, node, NULL); phys_addr_t addr, size; - addr = fdtdec_get_addr_size(blob, node, "reg", &size); + addr = fdtdec_get_addr_size_auto_parent(blob, parent, node, + "reg", 0, &size, false); if (addr == FDT_ADDR_T_NONE) { debug("failed to read address/size for %s\n", name); continue;