From patchwork Wed Jun 10 05:36:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1306473 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=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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=orMIhlw4; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hbMj4jHMz9sSF for ; Wed, 10 Jun 2020 15:36:49 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C31A800A9; Wed, 10 Jun 2020 07:36:43 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="orMIhlw4"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 473328006B; Wed, 10 Jun 2020 07:36:42 +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,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3E4DD8006B for ; Wed, 10 Jun 2020 07:36:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pj1-x1044.google.com with SMTP id i12so392881pju.3 for ; Tue, 09 Jun 2020 22:36:39 -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; bh=4ekIqdP0wUnE8i85mdwcTFyIh003HpnEA8Gpoa4TycI=; b=orMIhlw4cYrw+lBWXop6yGunWiuPe+wEbEjttwPqZsDDiB4f0CjOgcfi8rorvt0/y/ Z+beK545BZeH1zhs4dtE3cdmpi1mcsyKJ7SPBnAAL/Ca0VHvgC9NOMNgM6h/bZOVQFE9 NVkw6jsy9DCVOOg68gVP3fCxcCXTAl5kOUm7LTWAEuwvq8uJ6k/fKezg4NCunRWKb03S Jijt4Oe6WFW1gj65eCYwYk3fbHlgHq9vnG2dnn1hkXcNqqMvn93UNB1bj/p1A4LiuXOP Cqfr+34XOBeHVzCFTyO6JHkQZV9ZhnIO74N/3EmTjJB2L3VOqrgbQIB4UCz9spkO5zQV a8Fw== 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; bh=4ekIqdP0wUnE8i85mdwcTFyIh003HpnEA8Gpoa4TycI=; b=MMWvyPNGhYYsQ2A3tfyvMJ18q7KKJARxxJNrwM6z2CErWk6S/SgTUMLAPPGRXnqBvJ A1K8NOJ/LQdZvOmaYOxoljotAfnpm3s0MPB7YfU0rsH6pf5bGwaGTaNNadKmXzmlkSjd nnfZpd8YpDl4a5jBmLMDiHXdoHh1IUN6W4jtGVqSVW4mXIm8CUDsnOF8PsULBpqr4i2/ xXmlmr3UA+hhqSUI5BSXmn0BRs1B9HiGvJ7I32eZhEIcDdp3kNkwqeD2k/DnGMvUeL5w gTVyV+Qppvj0MSuhLibdUQuVmxj12Dq7MIfRah63Lp8aih+8lYMycGr0tKE+EU1tCfyM xtVQ== X-Gm-Message-State: AOAM532sLY8fl1mQ08wQUI+nqcgcd7zGFl72I7zEDbiQ4yUVEqSyr3+2 fZn3JE/Uck8nteRkwwL8on8= X-Google-Smtp-Source: ABdhPJzpzff9VAQbO7ef2cPd9AajZnajaDTOIsRO6XFT57w9JxJ3lrnbTBBW5ak7MHHUVIt4o07kDQ== X-Received: by 2002:a17:90a:c70d:: with SMTP id o13mr1370848pjt.73.1591767397320; Tue, 09 Jun 2020 22:36:37 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id q13sm12077522pfk.8.2020.06.09.22.36.36 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jun 2020 22:36:36 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH v3 1/5] fdtdec: Fix the types of addr and size in fdtdec_add_reserved_memory() Date: Tue, 9 Jun 2020 22:36:27 -0700 Message-Id: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 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 From: Bin Meng fdtdec_get_addr_size() expects size is of type 'fdt_size_t', and return value is of type 'fdt_addr_t'. Adjust their types accordingly. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v1) lib/fdtdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 1f2b763..42f7a25 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1294,7 +1294,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename, /* find a matching node and return the phandle to that */ fdt_for_each_subnode(node, blob, parent) { const char *name = fdt_get_name(blob, node, NULL); - phys_addr_t addr, size; + fdt_addr_t addr; + fdt_size_t size; addr = fdtdec_get_addr_size(blob, node, "reg", &size); if (addr == FDT_ADDR_T_NONE) { From patchwork Wed Jun 10 05:36:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1306474 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=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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=CbQhaTq+; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hbMw3MYLz9sRR for ; Wed, 10 Jun 2020 15:37:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 440C8813D4; Wed, 10 Jun 2020 07:36:47 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="CbQhaTq+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15A1E814A4; Wed, 10 Jun 2020 07:36:43 +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,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 133F3800A9 for ; Wed, 10 Jun 2020 07:36:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pl1-x644.google.com with SMTP id x11so514350plv.9 for ; Tue, 09 Jun 2020 22:36:39 -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; bh=p+CdoLLbr+8dczDxJuv7wu21U+BcGyFkLqV+BOFUaqw=; b=CbQhaTq+kMBThoBfYshNcEB2MiQywmFGmgX64i/zz4sLF2UQ5AsBi3DkjqP8fut0TA QhIkCI52KOZg/9cW8WDpYU2l6d5t46ChMdv2zakYSfMdxQi57OqQI9R/RwgiT8j6Xw9p udGC/TZBCaRlXmJ33x40cQRL6sFO7Me+q3uSsB9TyV5bHlF5w/eUSXeS9z3wAAGLtV5Z UynMUa1yreFUvBhrQRmoNrvfxaHW7jo9j7/6VPb3HbTfqwUMbEQvRemn6u4Oayn6CYnN 3uwXvB6dIBeqtuxo9eKtCeIrDHrsPkHmxqxeRy63oc2RjaREaKqMTq4kl8lHAou//yKr vJ0g== 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; bh=p+CdoLLbr+8dczDxJuv7wu21U+BcGyFkLqV+BOFUaqw=; b=tu9r65VPdB0UspL+v0EdYYOP02oVEV8t96hTJCWkM1QkKRFz+xziQ0QCfUrXdBVBth vmHi3l918oDvOG+qwdGfocuxeI/afTFj593QUpsiFAF2PmJaOr5g6CpcbSeJzYnFe1Ip FbbxSJEYXq7Padqyx9nE5D+7lX2ccfR7Kn78GEGV7CQEfCuYduhVc+qtmpx9W0h+UGMi vMiCsw4RpWutQcB3RZcOX15LaCNg5/WYkXrq18oq9M8kGQCcYqoy7WuwshCQ3nvKJRwL JEpqw3Irt8niOFAmwqWKuXquC2tog54PfNJD7lcoC0o3u7Z6XTR1DN4wT5LcoLGCTU6A UGMA== X-Gm-Message-State: AOAM531rK57c9kir9CeQWEvnxe27mwyZbfXZL1u55t32fmgQTyQK1Vpj zuAe65BbRB0CkcJpOLWLFXg= X-Google-Smtp-Source: ABdhPJyRnFSr3j52zPsOCubasVVx+FfePb+7fkf5jPoBwGgPdTfKDnwtQx80ceTi5m17UN/HNHJU7g== X-Received: by 2002:a17:90a:d3c6:: with SMTP id d6mr1403563pjw.68.1591767398221; Tue, 09 Jun 2020 22:36:38 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id q13sm12077522pfk.8.2020.06.09.22.36.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jun 2020 22:36:37 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH v3 2/5] fdtdec: Honor #address-cells and #size-cells in fdtdec_add_reserved_memory() Date: Tue, 9 Jun 2020 22:36:28 -0700 Message-Id: <1591767391-2669-2-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> References: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> 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 From: Bin Meng At present fdtdec_add_reserved_memory() calls fdtdec_get_addr_size() to get address and size for the subnodes of /reserved-memory node. We should honor #address-cells and #size-cells properties in the parent node. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v1) lib/fdtdec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 42f7a25..0dd7ff1 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1297,7 +1297,8 @@ int fdtdec_add_reserved_memory(void *blob, const char *basename, fdt_addr_t addr; fdt_size_t size; - addr = fdtdec_get_addr_size(blob, node, "reg", &size); + addr = fdtdec_get_addr_size_fixed(blob, node, "reg", 0, na, ns, + &size, false); if (addr == FDT_ADDR_T_NONE) { debug("failed to read address/size for %s\n", name); continue; From patchwork Wed Jun 10 05:36:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1306475 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=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=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=F0MytJX7; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hbN656cMz9sSS for ; Wed, 10 Jun 2020 15:37:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C51998179A; Wed, 10 Jun 2020 07:36:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="F0MytJX7"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2870381775; Wed, 10 Jun 2020 07:36:45 +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,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AE6A080355 for ; Wed, 10 Jun 2020 07:36:40 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x444.google.com with SMTP id 64so596445pfv.11 for ; Tue, 09 Jun 2020 22:36:40 -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; bh=lUa92wnrsA9xNTWFQK48EmeuTAhDq29syjE4Ljcy74Q=; b=F0MytJX74RuPJoiVcecLtnPxhz28HHZz+9Ke28EQst+PYL73x1FEE7XARlcWQFw5uV UTOQSiPf0FBLPUzSZ8VuBSE9pwyALh5U9+w7HWdtpHftXCm1yWE7pJOZPHuur8tKF5gG B71WEJQfz36XWZFr7h4hMJwwxVNft+WQNCf6jEVcanI2IJaUJjtfWh+4qFNY2I4NubMy T/YAFf6r7hpb89kuO2Yi7nIlRwtyyS6XplRbOBIEJOL9jEQq8ETE7mn2OR9WXNUhi99L tlphFY1/meAQ19CeFhQ7u4xI1urrwLoBXeWBZnzD/MmOYR/+5kKJdslvdpwwHF5bsMbX Q1vw== 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; bh=lUa92wnrsA9xNTWFQK48EmeuTAhDq29syjE4Ljcy74Q=; b=U4ZKSLUD9DYSqm6gfUWCO16q72HGAboiH1MzgpXOGpjkZmKcG6cqMfo2dfBAoYQhUJ 7IPFvIGBxWkLGT7A/rcVJVrY0GYxXuRS4RB2/w5N66r0YW9MhA6bbHJenBHXNATmslM8 59sX58Zpb5JYPHHkt+gudNt6+rNygYwh6C3sfo5ZtTeSzX3vURKnrHU8Hf7zQqWtsare rBt342F4zOqijT2wDeK7t1e2oyW+nHW/amDaMJayuwxUoewwOO/r1Tn7lmzYI7Su2xJF KPrATCen9f/xKAKL3d817fg0ymBuerrcCcN5fAe4RozvwRtcRgBbRawz/ZL8K9bMivbu sBYA== X-Gm-Message-State: AOAM531UaArwl8WJwLdadU7Kgvsle2BP3RJeU61lK9kXh3TJ3o7WQXct PntVMQnaULbsQDt4+G2yGLA= X-Google-Smtp-Source: ABdhPJxGgov6ar/qBv6vXl50zGTdTh+gh1zgQJGT/Uwe93ISxBE5oWQ9C+N8k5TZylJiju6ciPCCQQ== X-Received: by 2002:aa7:952d:: with SMTP id c13mr1196859pfp.125.1591767398985; Tue, 09 Jun 2020 22:36:38 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id q13sm12077522pfk.8.2020.06.09.22.36.38 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jun 2020 22:36:38 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH v3 3/5] test/dm: fdtdec: Add the missing gd declaration Date: Tue, 9 Jun 2020 22:36:29 -0700 Message-Id: <1591767391-2669-3-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> References: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> 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 From: Bin Meng Add DECLARE_GLOBAL_DATA_PTR since it is referenced in the test codes. Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v1) test/dm/fdtdec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c index b2f75b5..c2f7b94 100644 --- a/test/dm/fdtdec.c +++ b/test/dm/fdtdec.c @@ -9,6 +9,8 @@ #include #include +DECLARE_GLOBAL_DATA_PTR; + static int dm_test_fdtdec_set_carveout(struct unit_test_state *uts) { struct fdt_memory resv; From patchwork Wed Jun 10 05:36:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1306478 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=NxhsomAP; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49hbNW4YMrz9sRR for ; Wed, 10 Jun 2020 15:37:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 90830814A4; Wed, 10 Jun 2020 07:36:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="NxhsomAP"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 80F688168D; Wed, 10 Jun 2020 07:36:46 +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,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 243DF813BC for ; Wed, 10 Jun 2020 07:36:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x441.google.com with SMTP id b16so593448pfi.13 for ; Tue, 09 Jun 2020 22:36:41 -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; bh=5WTXE8IHuxox6mg9/mApbDalr93E9KcQr+Gxcqn4WQU=; b=NxhsomAPBzbEeZ6f9HoAxxsBV0HW7kGN3S1yOfM55056ly4XSCbp/kBGl1aDHc1FF1 N/+IJOSdfI7S/yJGxIKoH6V17GWea8bp0jxvr530U+peM8LgyM2BUqFIiKBX1p4kUnwg fBJgoNcipFoX6U03uAEU93wYN81jeEvBHfvIn3zeEiOS1IliEjHuL40N2StkQPJnBCGy 0FxE83bvXcQvOJfMXWZ5sUsBIvJmmlz3P7TmAIrXFeFevP3F1TujoKKRWXBFULj7OetZ JI1C8EX3OQQlwibwFt/Yq6E0PvPqZfopvqJKbr6eOjFgZnp6R12JLR9MhJ4T8pYkKID/ Albw== 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; bh=5WTXE8IHuxox6mg9/mApbDalr93E9KcQr+Gxcqn4WQU=; b=oDWTs8RXwjj9PlufFreWoj8mz+ejoY5KINZcLVb8C2HYEBYtzSdGxoCDotymvPBRO+ ygglmxSzZrXUSICB0y91qBtmVDIprhcB/Ks8CwLpu/5L+pYJVJ4lvCCtDy4zvfOKO5TO /ef+GOmeDSDdQ2pvSfWAx7tY337DikI/aeFiBkrCLEk3bH99np5TqBME0kxitOqsFgPX kZQVNNPEjCsorVDQr+l3+0IedQigdeBUpWahZY/3r2NC6SpNFWvNinSJdAaO7x9gC094 4+hkwZCBu6mBy2XNK0eXZowNNVj2yQjN8huUhD/qP2gM0985uwN4T11fHFsbefWHrCom ywEg== X-Gm-Message-State: AOAM530MA7zQ4LkWoVnPo7zjsw6coHso3umc+24QO4uLvfeVm2aaNQkc 7aBRWYNNvVxrXjKA2dSRQOA= X-Google-Smtp-Source: ABdhPJxR599A8xI7B71yMmanL12cEJOY69ENX87Fulj1YehffHDKaz20oMQGBOYnhbCFIIP0adviAg== X-Received: by 2002:a62:1849:: with SMTP id 70mr1162309pfy.227.1591767399714; Tue, 09 Jun 2020 22:36:39 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id q13sm12077522pfk.8.2020.06.09.22.36.39 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jun 2020 22:36:39 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH v3 4/5] test/dm: fdtdec: Corect a typo in dm_test_fdtdec_set_carveout() Date: Tue, 9 Jun 2020 22:36:30 -0700 Message-Id: <1591767391-2669-4-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> References: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> 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 From: Bin Meng It should be "writable". Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- (no changes since v1) test/dm/fdtdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c index c2f7b94..999d712 100644 --- a/test/dm/fdtdec.c +++ b/test/dm/fdtdec.c @@ -22,7 +22,7 @@ static int dm_test_fdtdec_set_carveout(struct unit_test_state *uts) blob = malloc(blob_sz); ut_assertnonnull(blob); - /* Make a writtable copy of the fdt blob */ + /* Make a writable copy of the fdt blob */ ut_assertok(fdt_open_into(gd->fdt_blob, blob, blob_sz)); resv.start = 0x1000; From patchwork Wed Jun 10 05:36:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 1306477 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=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=o8qpZzXT; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (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 49hbNP0nlvz9sRR for ; Wed, 10 Jun 2020 15:37:25 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 929A5819A0; Wed, 10 Jun 2020 07:36:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="o8qpZzXT"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5EF938168D; Wed, 10 Jun 2020 07:36:45 +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,FREEMAIL_FROM,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id E1666813D4 for ; Wed, 10 Jun 2020 07:36:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bmeng.cn@gmail.com Received: by mail-pf1-x441.google.com with SMTP id 23so600829pfw.10 for ; Tue, 09 Jun 2020 22:36:41 -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; bh=2KalhkKUUjDwQFWr6WSxzhNbQj3qa3b1UAq/SCX6GaI=; b=o8qpZzXTL4Obuxc7OlzDt+LKLgTT5nNvGuZq7T+Ftn6+PgdzX5MRUVFB+2abXfKTqG 5YRYbOR3cvh5Pr0fxbCT6uL1ZVf5viTghPnFuzhvk2sWgKndv+TbT+dHgwoQhZ9vxwE3 B4K4M+Be6m7wD5nR+SxY4u8rFOKx9zXKB5ZRJvgR1nzcptDo4Em30Ta/N5PpnJo3u5Vn qAiYHTEbIGCs6MWoBy5h7nrFJ/Al8GhnSA2rFoT1Xd3Ofa5NBe9/wc1fqtybAyfF1Q2i r/dHYTkgaeIkyyjJhSimYBTqRnHheeaheB0Ququ+wBnwtJWKHN605DHPUEkuSPUnhyig Ha9w== 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; bh=2KalhkKUUjDwQFWr6WSxzhNbQj3qa3b1UAq/SCX6GaI=; b=YmIejQp+RYcMgjGJnhmZAbtMe/93qipe9+tp8kjFMu7QJUhtnACwRPXkBnepocwHqO O0RroXzg9lbXgEnDjq9XKKWYgmsykNM1QGOKdm0MWNGqjzAY6GZB696pVBSPML0T40Aw 66b4wSh8u2AVhy2/FeC8gQX1V5fmtIR7DgCIiZUU6eqFxWk9a8evEN8tYSMy123iONRm BA45krvmImPbxFIszGzZ28ef8m3nt+kpek4Gn3MddsM722oP2HwxLkp/K8anXJzpeUCu 31DisY3IAUYzBhNz/wNP0MyN76oZF71Q7Hh3VQnI99+ceysqdbJXr2aUajusMKNLpChH Cezg== X-Gm-Message-State: AOAM530bvd5TRNXXEP649ZOqOgLzCYTS5qTD003kN7FfBnKpE6Tan0Iq WEGxUNr/95UNp81d+/6wU9o= X-Google-Smtp-Source: ABdhPJyu5SGhSaKYgH4qEqSnXyd2a7A8N1DvULGYwVcZH+z4ntGgCPaLbLPurIvkf82XiHVueM4AaA== X-Received: by 2002:a62:d158:: with SMTP id t24mr1185118pfl.267.1591767400604; Tue, 09 Jun 2020 22:36:40 -0700 (PDT) Received: from localhost.localdomain (unknown-224-80.windriver.com. [147.11.224.80]) by smtp.gmail.com with ESMTPSA id q13sm12077522pfk.8.2020.06.09.22.36.39 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 09 Jun 2020 22:36:40 -0700 (PDT) From: Bin Meng To: Simon Glass , U-Boot Mailing List Cc: Bin Meng Subject: [PATCH v3 5/5] test/dm: fdtdec: Add tests for fdtdec_add_reserved_memory() Date: Tue, 9 Jun 2020 22:36:31 -0700 Message-Id: <1591767391-2669-5-git-send-email-bmeng.cn@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> References: <1591767391-2669-1-git-send-email-bmeng.cn@gmail.com> 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 From: Bin Meng This adds a test case to test the functionality of the fdtdec API fdtdec_add_reserved_memory(). Signed-off-by: Bin Meng Reviewed-by: Simon Glass --- Changes in v3: - correct typo in the comments, and some minor rewording test/dm/fdtdec.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/test/dm/fdtdec.c b/test/dm/fdtdec.c index 999d712..56f6f4f 100644 --- a/test/dm/fdtdec.c +++ b/test/dm/fdtdec.c @@ -59,3 +59,72 @@ static int dm_test_fdtdec_set_carveout(struct unit_test_state *uts) } DM_TEST(dm_test_fdtdec_set_carveout, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE); + +static int dm_test_fdtdec_add_reserved_memory(struct unit_test_state *uts) +{ + struct fdt_memory resv; + fdt_addr_t addr; + fdt_size_t size; + void *blob; + int blob_sz, parent, subnode; + uint32_t phandle, phandle1; + + blob_sz = fdt_totalsize(gd->fdt_blob) + 128; + blob = malloc(blob_sz); + ut_assertnonnull(blob); + + /* Make a writable copy of the fdt blob */ + ut_assertok(fdt_open_into(gd->fdt_blob, blob, blob_sz)); + + /* Insert a memory region in /reserved-memory node */ + resv.start = 0x1000; + resv.end = 0x1fff; + ut_assertok(fdtdec_add_reserved_memory(blob, "rsvd_region", + &resv, &phandle)); + + /* Test /reserve-memory and its subnode should exist */ + parent = fdt_path_offset(blob, "/reserved-memory"); + ut_assert(parent > 0); + subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region"); + ut_assert(subnode > 0); + + /* Test reg property of /reserved-memory/rsvd_region node */ + addr = fdtdec_get_addr_size_auto_parent(blob, parent, subnode, + "reg", 0, &size, false); + ut_assert(addr == resv.start); + ut_assert(size == resv.end - resv.start + 1); + + /* Insert another memory region in /reserved-memory node */ + subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region1"); + ut_assert(subnode < 0); + + resv.start = 0x2000; + resv.end = 0x2fff; + ut_assertok(fdtdec_add_reserved_memory(blob, "rsvd_region1", + &resv, &phandle1)); + subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region1"); + ut_assert(subnode > 0); + + /* phandles must be different */ + ut_assert(phandle != phandle1); + + /* + * Insert a 3rd memory region with the same addr/size as the 1st one, + * but a new node should not be inserted due to the same addr/size. + */ + resv.start = 0x1000; + resv.end = 0x1fff; + ut_assertok(fdtdec_add_reserved_memory(blob, "rsvd_region2", + &resv, &phandle1)); + subnode = fdt_path_offset(blob, "/reserved-memory/rsvd_region2"); + ut_assert(subnode < 0); + + /* phandle must be same as the 1st one */ + ut_assert(phandle == phandle1); + + free(blob); + + return 0; +} +DM_TEST(dm_test_fdtdec_add_reserved_memory, + DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT | DM_TESTF_FLAT_TREE);