From patchwork Sat Oct 3 15:25:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376279 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Ct4S+0RZ; 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 4C3W0k1z1nz9sS8 for ; Sun, 4 Oct 2020 01:26:07 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AF9968233B; Sat, 3 Oct 2020 17:25:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Ct4S+0RZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EA0008232F; Sat, 3 Oct 2020 17:25:57 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) (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 26D388232F for ; Sat, 3 Oct 2020 17:25:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2d.google.com with SMTP id 67so1325761iob.8 for ; Sat, 03 Oct 2020 08:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7FG4AFYrcUnJcc1vTSOXSt9JMe3NbRo4tb722h56wWg=; b=Ct4S+0RZTeq4n0iRBEfoVYENf9i8O1TDVD6WEBfW54faMRoDsaUbZX/mYKEeFZRIHS TXBXLzeMUjBpAF3eAT/IeZM/fyuNy1QIr7lJxB1zFG4Si8DMH0e4IOT6jZ4pbLlkxDCa C/mIcPZ26SFUiHx361AAJhJ4FKr8eTXJNYhqo= 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=7FG4AFYrcUnJcc1vTSOXSt9JMe3NbRo4tb722h56wWg=; b=h+cONosESdmGrdPLnWQSnm1VGxm4u2IiUTSpIxwq/Y1b5Q+zi4mAdx7Iyo0tq5LuHh 8M3Lz3IpNHBOsQ709K9T29jAvmTLAvFhMhzrR7vEEoplhk6GupX3nAF87tMrjGKkL/v9 BoJ6aU0fkhxPKS6F/T/dlFEIFX7JZoM9zwVvBvJexzFWO/aYOgP01NPI0p0yQfs9aNE5 mXtZgB9vAb3AztnYEi0ZcFSDe6EprSh6DtCZ9MY5C2tfR1bdXpyME0Cs0oRQWNSZuzhY TxN0m/StyhY+g1B66ykpWPfmW/ml/JWnes/t8T/ADJdpaP30rWscHZ3g1c5lkiGWxM7L 3fLg== X-Gm-Message-State: AOAM530xeOTTwAocoSMODrvr2ugUJLCIzREOlj2aZXSKZ5ri6Sf+YzF+ 4xfqWNYbHAyrw4H+7tZvXQMmAYKMcJgTij+B X-Google-Smtp-Source: ABdhPJxTeenNjZNKmSJ5TOH6QYyVa1HyT/p3zrllJcsgSHbW+nLe9xNcIEoqRgyVVgirMd6F2mA/yw== X-Received: by 2002:a05:6638:f07:: with SMTP id h7mr6523781jas.25.1601738753834; Sat, 03 Oct 2020 08:25:53 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:53 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Walter Lozano Subject: [PATCH 01/17] dtoc: Extract inner loop from output_node() Date: Sat, 3 Oct 2020 09:25:18 -0600 Message-Id: <20201003152534.3184504-2-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean This function is very long. Put the inner loop in a separate function to enhance readability. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 89 +++++++++++++++++++++----------------- 1 file changed, 49 insertions(+), 40 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index 579a6749c40..bd1daa4379a 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -560,6 +560,54 @@ class DtbPlatdata(object): Args: node: node to output """ + def _output_list(node, prop): + """Output the C code for a devicetree property that holds a list + + Args: + node (fdt.Node): Node to output + prop (fdt.Prop): Prop to output + """ + self.buf('{') + vals = [] + # For phandles, output a reference to the platform data + # of the target node. + info = self.get_phandle_argc(prop, node.name) + if info: + # Process the list as pairs of (phandle, id) + pos = 0 + item = 0 + for args in info.args: + phandle_cell = prop.value[pos] + phandle = fdt_util.fdt32_to_cpu(phandle_cell) + target_node = self._fdt.phandle_to_node[phandle] + name = conv_name_to_c(target_node.name) + arg_values = [] + for i in range(args): + arg_values.append(str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) + pos += 1 + args + # node member is filled with NULL as the real value + # will be update at run-time during dm_init_and_scan() + # by dm_populate_phandle_data() + vals.append('\t{NULL, {%s}}' % (', '.join(arg_values))) + var_node = '%s%s.%s[%d].node' % \ + (VAL_PREFIX, var_name, member_name, item) + # Save the the link information to be use to define + # dm_populate_phandle_data() + self._links.append({'var_node': var_node, 'dev_name': name}) + item += 1 + for val in vals: + self.buf('\n\t\t%s,' % val) + else: + for val in prop.value: + vals.append(get_value(prop.type, val)) + + # Put 8 values per line to avoid very long lines. + for i in range(0, len(vals), 8): + if i: + self.buf(',\n\t\t') + self.buf(', '.join(vals[i:i + 8])) + self.buf('}') + struct_name, _ = self.get_normalized_compat_name(node) var_name = conv_name_to_c(node.name) self.buf('static struct %s%s %s%s = {\n' % @@ -573,46 +621,7 @@ class DtbPlatdata(object): # Special handling for lists if isinstance(prop.value, list): - self.buf('{') - vals = [] - # For phandles, output a reference to the platform data - # of the target node. - info = self.get_phandle_argc(prop, node.name) - if info: - # Process the list as pairs of (phandle, id) - pos = 0 - item = 0 - for args in info.args: - phandle_cell = prop.value[pos] - phandle = fdt_util.fdt32_to_cpu(phandle_cell) - target_node = self._fdt.phandle_to_node[phandle] - name = conv_name_to_c(target_node.name) - arg_values = [] - for i in range(args): - arg_values.append(str(fdt_util.fdt32_to_cpu(prop.value[pos + 1 + i]))) - pos += 1 + args - # node member is filled with NULL as the real value - # will be update at run-time during dm_init_and_scan() - # by dm_populate_phandle_data() - vals.append('\t{NULL, {%s}}' % (', '.join(arg_values))) - var_node = '%s%s.%s[%d].node' % \ - (VAL_PREFIX, var_name, member_name, item) - # Save the the link information to be use to define - # dm_populate_phandle_data() - self._links.append({'var_node': var_node, 'dev_name': name}) - item += 1 - for val in vals: - self.buf('\n\t\t%s,' % val) - else: - for val in prop.value: - vals.append(get_value(prop.type, val)) - - # Put 8 values per line to avoid very long lines. - for i in range(0, len(vals), 8): - if i: - self.buf(',\n\t\t') - self.buf(', '.join(vals[i:i + 8])) - self.buf('}') + _output_list(node, prop) else: self.buf(get_value(prop.type, prop.value)) self.buf(',\n') From patchwork Sat Oct 3 15:25:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376280 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=nBbxe8K9; 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 4C3W115trzz9s1t for ; Sun, 4 Oct 2020 01:26:29 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E7D682353; Sat, 3 Oct 2020 17:26:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="nBbxe8K9"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E2598233B; Sat, 3 Oct 2020 17:25:59 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 17A4882332 for ; Sat, 3 Oct 2020 17:25:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id c5so3929943ilk.11 for ; Sat, 03 Oct 2020 08:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9XklTBdzPN/th9Ys86ILjLe0JlHFjQdqFVFjTDit5rU=; b=nBbxe8K9jtEhfK1Ef2uP/FrxAMzSA/ZMqTkL6GH2FAUv1e7cgL/68LBW7cvTvhNPKN Rt2vkF8C66PYSOSz6ncaM7blRVaBVKUD4vK2fEvx6kF0H/Zm6fPNMVJxEXFfyxZ5Hyas oRgcqm2mPpWhB0QQsY0FurLESVy/Da80ui8Ns= 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=9XklTBdzPN/th9Ys86ILjLe0JlHFjQdqFVFjTDit5rU=; b=AfCh2vHuYFa21zf/9Jmn0AFr3dYpu9vJF/mLjIdAtogEgDSbBzWrY9br0Hj19HGIsz 4UYGrCdHb/huUWcdTwmcxgyeow6ECWV7VnWX+SqxpF3fHqUwq62C4OV7/t23XWhaiX3n n2sfIiAUWC9K3XEHCNTkiRlhNwrYc5cxFJV5JZ575Noz0OxmpH8uIlQ1DiQWC324JksD lcVataWiOXAjwnjt8P5IYxClt0kbrB8puuAonGS/k8Ux4lN4FHTF2HGlYCr5OD6c/DoK v+9NZHhe2xRrEdmbctyNlr9EGPRTr42BCiGvC9Yk0uiIt6cUmWdGbZ54YreLUssfoM3r jEzQ== X-Gm-Message-State: AOAM531HGa3peAV6MoRZAcZGZ+k3dYgijFx9SuQeobU0XXej+iMg/wWs 7A47tm4zsG2JvU9zX9GhDA90yEh0NLSADNb+ X-Google-Smtp-Source: ABdhPJyztH6lSh98qqwEWfaLVMCepKTvGsElQlKf3FZ2De8WQpACJHyYKVTPAZjftQnC8WHpwqLJRA== X-Received: by 2002:a92:1303:: with SMTP id 3mr5531059ilt.117.1601738754775; Sat, 03 Oct 2020 08:25:54 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:54 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Walter Lozano Subject: [PATCH 02/17] dtoc: Use a namedtuple for _links Date: Sat, 3 Oct 2020 09:25:19 -0600 Message-Id: <20201003152534.3184504-3-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean The use of strings to access a dict is a bit ugly. Use a namedtuple for this instead. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/dtoc/dtb_platdata.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/dtoc/dtb_platdata.py b/tools/dtoc/dtb_platdata.py index bd1daa4379a..1b52198a943 100644 --- a/tools/dtoc/dtb_platdata.py +++ b/tools/dtoc/dtb_platdata.py @@ -54,6 +54,13 @@ VAL_PREFIX = 'dtv_' # phandles is len(args). This is a list of integers. PhandleInfo = collections.namedtuple('PhandleInfo', ['max_args', 'args']) +# Holds a single phandle link, allowing a C struct value to be assigned to point +# to a device +# +# var_node: C variable to assign (e.g. 'dtv_mmc.clocks[0].node') +# dev_name: Name of device to assign to (e.g. 'clock') +PhandleLink = collections.namedtuple('PhandleLink', ['var_node', 'dev_name']) + def conv_name_to_c(name): """Convert a device-tree name to a C identifier @@ -146,7 +153,8 @@ class DtbPlatdata(object): key: Driver alias declared with U_BOOT_DRIVER_ALIAS(driver_alias, driver_name) value: Driver name declared with U_BOOT_DRIVER(driver_name) - _links: List of links to be included in dm_populate_phandle_data() + _links: List of links to be included in dm_populate_phandle_data(), + each a PhandleLink _drivers_additional: List of additional drivers to use during scanning """ def __init__(self, dtb_fname, include_disabled, warning_disabled, @@ -593,7 +601,7 @@ class DtbPlatdata(object): (VAL_PREFIX, var_name, member_name, item) # Save the the link information to be use to define # dm_populate_phandle_data() - self._links.append({'var_node': var_node, 'dev_name': name}) + self._links.append(PhandleLink(var_node, name)) item += 1 for val in vals: self.buf('\n\t\t%s,' % val) @@ -669,9 +677,9 @@ class DtbPlatdata(object): # nodes using DM_GET_DEVICE # dtv_dmc_at_xxx.clocks[0].node = DM_GET_DEVICE(clock_controller_at_xxx) self.buf('void dm_populate_phandle_data(void) {\n') - for l in self._links: + for link in self._links: self.buf('\t%s = DM_GET_DEVICE(%s);\n' % - (l['var_node'], l['dev_name'])) + (link.var_node, link.dev_name)) self.buf('}\n') self.out(''.join(self.get_buf())) From patchwork Sat Oct 3 15:25:20 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376281 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=OBIGWIGp; 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 4C3W142Dxvz9s1t for ; Sun, 4 Oct 2020 01:26:32 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6AA2A82361; Sat, 3 Oct 2020 17:26:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="OBIGWIGp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 621FC82334; Sat, 3 Oct 2020 17:26:00 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 EEE7982334 for ; Sat, 3 Oct 2020 17:25:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id j13so3948924ilc.4 for ; Sat, 03 Oct 2020 08:25:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=16GP/csw9c1So5ITySwfUVIKSR2iNloOn9q07xbc0PQ=; b=OBIGWIGp6uDQEnpWT7/DWTNfjnNB2+PGiU/W3JTO17JUSfILKZeFx9QZAf0Ptu0JLb hXaSHw/Y1eP94DOjbtGijwsBPkNE7T7aoKgx9LF1fPHb27FFMJQLEEWFnJNLCGxOnwZD Omscb3gReJwjnvlk2FwaJEyje/50XT9P484zg= 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=16GP/csw9c1So5ITySwfUVIKSR2iNloOn9q07xbc0PQ=; b=BXGm+tkL15IrFU7DZWXu01duLUSnTlf9aaWZesJjsXnYrvr0Nh4m4JzgPGMjNf+1yc VYrj1zDTwMGSwzpejDTUgQjDLFLWE3idHESITooYg/JHE/qlTXqjHGlNWOwJ3W+F2zq6 +NwewbFZ0XFtsPkrYsd0hn7Rmq+BmTvqVinKEcFBkpQGoAxHxIWOMNP97s8GBhcfpcEy +lj8tsnuYYttmVIfPMTSWvA5D0jIws4Mr6/hSQyFw8r1H9j3GuwVn7mfzgIPFfcYsNtj 35EKnjovBhqRwkjll2OV3MpfYjHEanGGYEtlRapyTuFm4CzMV5I01yNcSo86tVo5s0MA jhtQ== X-Gm-Message-State: AOAM53105Rm4PezuJrNLH6Da+mNtJWp4QfxL1zp9RNDV2eqC1zZqlzmD I5raikRy14pKBnL9XfTZMAM3YnQusxshdRFg X-Google-Smtp-Source: ABdhPJxGe1PAFfHfjszUoWx5P2YkIA22IotaOtJ2VqHOj2bL+tDfIOmB5M2i25uJxlooI9d3iQPtIg== X-Received: by 2002:a92:c951:: with SMTP id i17mr5448061ilq.158.1601738755728; Sat, 03 Oct 2020 08:25:55 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:55 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 03/17] dm: core: Expand the comment for DM_GET_DEVICE() Date: Sat, 3 Oct 2020 09:25:20 -0600 Message-Id: <20201003152534.3184504-4-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean The current documentation for this is not particularly enlightening. Add a little more detail. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/dm/platdata.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/dm/platdata.h b/include/dm/platdata.h index cab93b071ba..25479b03d22 100644 --- a/include/dm/platdata.h +++ b/include/dm/platdata.h @@ -45,7 +45,22 @@ struct driver_info { #define U_BOOT_DEVICES(__name) \ ll_entry_declare_list(struct driver_info, __name, driver_info) -/* Get a pointer to a given driver */ +/** + * Get a pointer to a given device info given its name + * + * With the declaration U_BOOT_DEVICE(name), DM_GET_DEVICE(name) will return a + * pointer to the struct driver_info created by that declaration. + * + * if OF_PLATDATA is enabled, from this it is possible to use the @dev member of + * struct driver_info to find the device pointer itself. + * + * TODO(sjg@chromium.org): U_BOOT_DEVICE() tells U-Boot to create a device, so + * the naming seems sensible, but DM_GET_DEVICE() is a bit of misnomer, since it + * finds the driver_info record, not the device. + * + * @__name: Driver name (C identifier, not a string. E.g. gpio7_at_ff7e0000) + * @return struct driver_info * to the driver that created the device + */ #define DM_GET_DEVICE(__name) \ ll_entry_get(struct driver_info, __name, driver_info) From patchwork Sat Oct 3 15:25:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376282 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VliJQZ4r; 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 4C3W1J0f6Sz9s1t for ; Sun, 4 Oct 2020 01:26:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0646682390; Sat, 3 Oct 2020 17:26:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="VliJQZ4r"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A7F0082353; Sat, 3 Oct 2020 17:26:00 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) (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 D948A8233E for ; Sat, 3 Oct 2020 17:25:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x142.google.com with SMTP id c5so3346750ilr.9 for ; Sat, 03 Oct 2020 08:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y9F2KOzQOehYYruw8dch7WX7BdZ+o2UU9pgZ+g8O86g=; b=VliJQZ4rQqZs4o+v/xjZhII6OVQ1SqMSmSkYQfvwHLhDLV/tMVNrvueqi0l+iSQNvx gTUjt2fYJHQV7ogsK5ohTNOZfvMnkruqKUjv80qfYuAMWFhOmgSzM86nd4Erao/tV+R+ XpVnkcPoY8RHHdkbn8GkjbwWI34UYFGb39crw= 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=Y9F2KOzQOehYYruw8dch7WX7BdZ+o2UU9pgZ+g8O86g=; b=UHPCHJEfwMgSdCWrIBZW1gyr+2Hh8gCzE3VoAq2Ru1mhyx2iCnaKK6FOWoFacpIu4N ccXZJvbgC2frehNQZKx/hb3xk5XxR9jmhoEj72rbUZaJgstvafq8N3Psxe1l7QYDws9e j6yFTkMaKuieV84uAmdibS295lqVk9vIkgVnY4F0LKGGP2b0fFBpS/LoHdYnFNgO7WLN 8XzXQHulhrNCP32C21AlKJnGJ0zdI5z89IvuqYMQtH31sU2UlV4hM7oM4gUqFNeqGjGr ffaHAWFOO44Dd3dm3e+CR4GAE1l5A1C3Y5Tx5txzFEAya7iOGmrUFds5fTSaf0fJeKav 4OqA== X-Gm-Message-State: AOAM5337auRhhx7F1o2rGZW/xRmwMXCcrbVZqWlG4bUZLWK7dRsWnFK2 GbTQp76/B0AE1g2JaHQ/+3wNc+NwrIceSIH1 X-Google-Smtp-Source: ABdhPJwFrrvK76LO+527Ko9tlFekaPK4cacvBpdGBG/62VTxFod1cQzoMX4uvTCz27NQ3wrU5lA7Qg== X-Received: by 2002:a92:cc41:: with SMTP id t1mr6059030ilq.19.1601738756711; Sat, 03 Oct 2020 08:25:56 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:56 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 04/17] dm: core: Avoid void * in the of-platdata structs Date: Sat, 3 Oct 2020 09:25:21 -0600 Message-Id: <20201003152534.3184504-5-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean These pointers point to drivers. Update the definition to make this clear. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/dt-structs.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/include/dt-structs.h b/include/dt-structs.h index 924d51fc522..eed8273d18e 100644 --- a/include/dt-structs.h +++ b/include/dt-structs.h @@ -8,18 +8,20 @@ /* These structures may only be used in SPL */ #if CONFIG_IS_ENABLED(OF_PLATDATA) +struct driver_info; + struct phandle_0_arg { - const void *node; + const struct driver_info *node; int arg[0]; }; struct phandle_1_arg { - const void *node; + const struct driver_info *node; int arg[1]; }; struct phandle_2_arg { - const void *node; + const struct driver_info *node; int arg[2]; }; #include From patchwork Sat Oct 3 15:25:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376283 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Hn1enHh8; 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 4C3W1Z1Kfzz9s1t for ; Sun, 4 Oct 2020 01:26:57 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 97E018239B; Sat, 3 Oct 2020 17:26:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Hn1enHh8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1B4A58235E; Sat, 3 Oct 2020 17:26:03 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 7943C8232F for ; Sat, 3 Oct 2020 17:25:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id y13so4685763iow.4 for ; Sat, 03 Oct 2020 08:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EaZlq/bpN8z0g+NlfrNxibu6Nkp005MPw+yzZ5Ci/Qw=; b=Hn1enHh8wGMVNBub8dSHn5ywqFQQiM56szWRX2XXbJl6tD8sTI0/WDq5YYn4vrc1Ou XsT/ZmlENhBxwYG9R0UDaJGY8pCuMGwEZ7wGm+Ar83GBNzlcbOrzFzjqRfMZTk9zuEyc paxuZu91dEhTCiaMHU4otwplyHRtvi+jjgnWQ= 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=EaZlq/bpN8z0g+NlfrNxibu6Nkp005MPw+yzZ5Ci/Qw=; b=OvEh8toV5/A/muBB25jgykOU1V8LJTrVlQT/nFMuSAt3vSqj9Eszt4bKJdw8KrAq5F NztOMLm/9AQvaLGue+/nAK3827Cjqsxma5g6NjzOrYI3+slMpz55VYbv97PQMXGWQhnn MAKPoNDo0w3Q8/OxWyF589aE6c/2Al6/4N+Oc1fGsa1nalvtV25OajxVGe3ZujZQxWKu OhzybNFPPqgTMSghsf+nThAOl8Hkaa2gTanZUmM6LDhnk5dtQObmWAP4lHX1438UB30q bVUzXQLVppZCy8uHAgV3HWFMp2rNaw/BsR6U1pK/UiprSv11NNcNqIEZQljnrHkAVx4X xNwQ== X-Gm-Message-State: AOAM532ItnvJXFJ/iV/tSyLcpt97Alb3Q2yTSQ/bEHWdJgrsttVHCCxK 1fdUEKXmoQ4Cdvxp3VQAT/izLbQChw0w5byO X-Google-Smtp-Source: ABdhPJw16AhwTiLZlIKM2jFrE4AgKHXi7Dr/cc4LaHxgHcCUgNJ16pk623gMs9IuuaKzZw5RCyYDvw== X-Received: by 2002:a6b:650b:: with SMTP id z11mr5788667iob.60.1601738758094; Sat, 03 Oct 2020 08:25:58 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:57 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Anastasiia Lukianenko , Angelo Durgehello , Baruch Siach , Bin Meng , Marek Vasut , Masahiro Yamada , Oleksandr Andrushchenko , Ovidiu Panait , Pavel Herrmann , Peng Fan , Wolfgang Wallner , Xiaowei Bao Subject: [PATCH 05/17] dm: Avoid using #ifdef for CONFIG_OF_LIVE Date: Sat, 3 Oct 2020 09:25:22 -0600 Message-Id: <20201003152534.3184504-6-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean At present this option results in a number of #ifdefs due to the presence or absence of the global_data of_root member. Add a few macros to global_data.h to work around this. Update the code accordingly. Signed-off-by: Simon Glass --- common/board_r.c | 19 +++++++++---------- drivers/core/Makefile | 2 +- drivers/core/root.c | 27 +++++++++------------------ include/asm-generic/global_data.h | 13 ++++++++++++- include/dm/of.h | 9 +-------- test/dm/test-main.c | 16 +++++----------- 6 files changed, 37 insertions(+), 49 deletions(-) diff --git a/common/board_r.c b/common/board_r.c index 9b2fec701a5..1f37345f940 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -295,20 +295,21 @@ static int initr_noncached(void) } #endif -#ifdef CONFIG_OF_LIVE static int initr_of_live(void) { - int ret; + if (CONFIG_IS_ENABLED(OF_LIVE)) { + int ret; - bootstage_start(BOOTSTAGE_ID_ACCUM_OF_LIVE, "of_live"); - ret = of_live_build(gd->fdt_blob, (struct device_node **)&gd->of_root); - bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE); - if (ret) - return ret; + bootstage_start(BOOTSTAGE_ID_ACCUM_OF_LIVE, "of_live"); + ret = of_live_build(gd->fdt_blob, + (struct device_node **)gd_of_root_ptr()); + bootstage_accum(BOOTSTAGE_ID_ACCUM_OF_LIVE); + if (ret) + return ret; + } return 0; } -#endif #ifdef CONFIG_DM static int initr_dm(void) @@ -701,9 +702,7 @@ static init_fnc_t init_sequence_r[] = { #ifdef CONFIG_SYS_NONCACHED_MEMORY initr_noncached, #endif -#ifdef CONFIG_OF_LIVE initr_of_live, -#endif #ifdef CONFIG_DM initr_dm, #endif diff --git a/drivers/core/Makefile b/drivers/core/Makefile index 10f4bece335..5edd4e41357 100644 --- a/drivers/core/Makefile +++ b/drivers/core/Makefile @@ -11,7 +11,7 @@ obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o obj-$(CONFIG_DM) += dump.o obj-$(CONFIG_$(SPL_TPL_)REGMAP) += regmap.o obj-$(CONFIG_$(SPL_TPL_)SYSCON) += syscon-uclass.o -obj-$(CONFIG_OF_LIVE) += of_access.o of_addr.o +obj-$(CONFIG_$(SPL_)OF_LIVE) += of_access.o of_addr.o ifndef CONFIG_DM_DEV_READ_INLINE obj-$(CONFIG_OF_CONTROL) += read.o endif diff --git a/drivers/core/root.c b/drivers/core/root.c index 0726be6b795..de23161cff8 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -61,7 +61,7 @@ void fix_drivers(void) for (entry = drv; entry != drv + n_ents; entry++) { if (entry->of_match) entry->of_match = (const struct udevice_id *) - ((u32)entry->of_match + gd->reloc_off); + ((ulong)entry->of_match + gd->reloc_off); if (entry->bind) entry->bind += gd->reloc_off; if (entry->probe) @@ -151,11 +151,9 @@ int dm_init(bool of_live) if (ret) return ret; #if CONFIG_IS_ENABLED(OF_CONTROL) -# if CONFIG_IS_ENABLED(OF_LIVE) - if (of_live) - DM_ROOT_NON_CONST->node = np_to_ofnode(gd->of_root); + if (CONFIG_IS_ENABLED(OF_LIVE) && of_live) + DM_ROOT_NON_CONST->node = np_to_ofnode(gd_of_root()); else -#endif DM_ROOT_NON_CONST->node = offset_to_ofnode(0); #endif ret = device_probe(DM_ROOT_NON_CONST); @@ -196,7 +194,7 @@ int dm_scan_platdata(bool pre_reloc_only) return ret; } -#if CONFIG_IS_ENABLED(OF_LIVE) +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) static int dm_scan_fdt_live(struct udevice *parent, const struct device_node *node_parent, bool pre_reloc_only) @@ -223,9 +221,7 @@ static int dm_scan_fdt_live(struct udevice *parent, return ret; } -#endif /* CONFIG_IS_ENABLED(OF_LIVE) */ -#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) /** * dm_scan_fdt_node() - Scan the device tree and bind drivers for a node * @@ -272,24 +268,20 @@ int dm_scan_fdt_dev(struct udevice *dev) if (!dev_of_valid(dev)) return 0; -#if CONFIG_IS_ENABLED(OF_LIVE) if (of_live_active()) return dm_scan_fdt_live(dev, dev_np(dev), gd->flags & GD_FLG_RELOC ? false : true); - else -#endif + return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev), gd->flags & GD_FLG_RELOC ? false : true); } int dm_scan_fdt(const void *blob, bool pre_reloc_only) { -#if CONFIG_IS_ENABLED(OF_LIVE) if (of_live_active()) - return dm_scan_fdt_live(gd->dm_root, gd->of_root, + return dm_scan_fdt_live(gd->dm_root, gd_of_root(), pre_reloc_only); - else -#endif + return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only); } @@ -302,10 +294,9 @@ static int dm_scan_fdt_ofnode_path(const void *blob, const char *path, if (!ofnode_valid(node)) return 0; -#if CONFIG_IS_ENABLED(OF_LIVE) if (of_live_active()) return dm_scan_fdt_live(gd->dm_root, node.np, pre_reloc_only); -#endif + return dm_scan_fdt_node(gd->dm_root, blob, node.of_offset, pre_reloc_only); } @@ -352,7 +343,7 @@ int dm_init_and_scan(bool pre_reloc_only) dm_populate_phandle_data(); #endif - ret = dm_init(IS_ENABLED(CONFIG_OF_LIVE)); + ret = dm_init(CONFIG_IS_ENABLED(OF_LIVE)); if (ret) { debug("dm_init() failed: %d\n", ret); return ret; diff --git a/include/asm-generic/global_data.h b/include/asm-generic/global_data.h index d4a4e2215dc..d6f562d90d4 100644 --- a/include/asm-generic/global_data.h +++ b/include/asm-generic/global_data.h @@ -75,7 +75,7 @@ typedef struct global_data { const void *fdt_blob; /* Our device tree, NULL if none */ void *new_fdt; /* Relocated FDT */ unsigned long fdt_size; /* Space reserved for relocated FDT */ -#ifdef CONFIG_OF_LIVE +#if CONFIG_IS_ENABLED(OF_LIVE) struct device_node *of_root; #endif @@ -146,6 +146,17 @@ typedef struct global_data { #define gd_board_type() 0 #endif +/* These macros help avoid #ifdefs in the code */ +#if CONFIG_IS_ENABLED(OF_LIVE) +#define gd_of_root() gd->of_root +#define gd_of_root_ptr() &gd->of_root +#define gd_set_of_root(_root) gd->of_root = (_root) +#else +#define gd_of_root() NULL +#define gd_of_root_ptr() NULL +#define gd_set_of_root(_root) +#endif + /* * Global Data Flags */ diff --git a/include/dm/of.h b/include/dm/of.h index 6bef73b441c..5cb6f44a6c6 100644 --- a/include/dm/of.h +++ b/include/dm/of.h @@ -90,17 +90,10 @@ DECLARE_GLOBAL_DATA_PTR; * * @returns true if livetree is active, false it not */ -#ifdef CONFIG_OF_LIVE static inline bool of_live_active(void) { - return gd->of_root != NULL; + return gd_of_root() != NULL; } -#else -static inline bool of_live_active(void) -{ - return false; -} -#endif #define OF_BAD_ADDR ((u64)-1) diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 38b7b1481a7..995988723ae 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -33,10 +33,8 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live) memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count)); state_reset_for_test(state_get_current()); -#ifdef CONFIG_OF_LIVE /* Determine whether to make the live tree available */ - gd->of_root = of_live ? uts->of_root : NULL; -#endif + gd_set_of_root(of_live ? uts->of_root : NULL); ut_assertok(dm_init(of_live)); dms->root = dm_root(); @@ -152,9 +150,7 @@ static int dm_test_main(const char *test_name) printf("Running %d driver model tests\n", n_ents); found = 0; -#ifdef CONFIG_OF_LIVE - uts->of_root = gd->of_root; -#endif + uts->of_root = gd_of_root(); for (test = tests; test < tests + n_ents; test++) { const char *name = test->name; int runs; @@ -167,7 +163,7 @@ static int dm_test_main(const char *test_name) /* Run with the live tree if possible */ runs = 0; - if (IS_ENABLED(CONFIG_OF_LIVE)) { + if (CONFIG_IS_ENABLED(OF_LIVE)) { if (!(test->flags & UT_TESTF_FLAT_TREE)) { ut_assertok(dm_do_test(uts, test, true)); runs++; @@ -192,11 +188,9 @@ static int dm_test_main(const char *test_name) printf("Failures: %d\n", uts->fail_count); /* Put everything back to normal so that sandbox works as expected */ -#ifdef CONFIG_OF_LIVE - gd->of_root = uts->of_root; -#endif + gd_set_of_root(uts->of_root); gd->dm_root = NULL; - ut_assertok(dm_init(IS_ENABLED(CONFIG_OF_LIVE))); + ut_assertok(dm_init(CONFIG_IS_ENABLED(OF_LIVE))); dm_scan_platdata(false); dm_scan_fdt(gd->fdt_blob, false); From patchwork Sat Oct 3 15:25:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376287 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jyWksc9b; 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 4C3W2f68yjz9s1t for ; Sun, 4 Oct 2020 01:27:54 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 28436823B3; Sat, 3 Oct 2020 17:26:14 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="jyWksc9b"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BB72D8232F; Sat, 3 Oct 2020 17:26:06 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x144.google.com (mail-il1-x144.google.com [IPv6:2607:f8b0:4864:20::144]) (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 4B7CD82355 for ; Sat, 3 Oct 2020 17:26:00 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x144.google.com with SMTP id q5so3957097ilj.1 for ; Sat, 03 Oct 2020 08:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ff9wlpUxBZoHCBSjf7gi4vktfgF92NEyp+wglHuHAOs=; b=jyWksc9b+0pUVrHRebMLGE9KQL3f4zj5WUfUZQEQ7t4/c5FRKwWBnPo9ZsRVFcPBkn XZNC8QIWTlmrimEl8dzV5wOPcp+/5Zavi8VNwyCg8K1GOBBrzojUYDFAkEDgPvyHDepY k6S1UMT6URcekHKXMzWqGUclDeECYKaZwtUhg= 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=ff9wlpUxBZoHCBSjf7gi4vktfgF92NEyp+wglHuHAOs=; b=lnJ9WaJPrbh+2X8Hg9lapvZIRQ7xK3tP2jplQRecA0JcGiWYuIjoNmLnOrNUzHS/vu Ylef70XrzcpUTnZFIp91MsYHByQ5G1sOTjFSDWz3CY5Ct6tqSxlUanOXVhiDcIgJn9y8 6ydwIGrdj/3rAYLmr3pl/uUHAgBLin5K2iNi8xKxw5UvSxzLMwIPoJmtLkTryG0+Vwvj BO+nVzqD7MmkINoPe5T3uYop9tDosnzKGR5UVadzjzVeRmr4YoEjwoIIzNeQHCJYBEVi V97lmMsYCtl3ar5f6yFb85JpQcyd2b7sEMpAedEZw5/wOu5O4j4BUxTSBsLEib/GDdCr AUIw== X-Gm-Message-State: AOAM533lTF2Snr35cDRxSAGa1MdbvJ+w10q0uypOYozFqdudKmtj+pkS AF56zTJuzxZFPrDVBp6HlK3jGpqVA6SmmcjF X-Google-Smtp-Source: ABdhPJyWRZHUQ5gpi4LTP0e8QCIgpsg5fQeKQ5WE0DKRFLEfHtzqO03iiflcTnkdQ+lvu7YYc9yLLw== X-Received: by 2002:a92:5b02:: with SMTP id p2mr5576873ilb.283.1601738759089; Sat, 03 Oct 2020 08:25:59 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:58 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Marek Vasut , Pavel Herrmann Subject: [PATCH 06/17] dm: test: Sort the Makefile Date: Sat, 3 Oct 2020 09:25:23 -0600 Message-Id: <20201003152534.3184504-7-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Move everything into alphabetical order. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Makefile b/test/Makefile index 7c4039964e1..13ee661f50e 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,12 +5,12 @@ obj-$(CONFIG_SANDBOX) += bloblist.o obj-$(CONFIG_CMDLINE) += cmd/ obj-$(CONFIG_UNIT_TEST) += cmd_ut.o -obj-$(CONFIG_UNIT_TEST) += ut.o obj-$(CONFIG_SANDBOX) += command_ut.o obj-$(CONFIG_SANDBOX) += compression.o +obj-$(CONFIG_UNIT_TEST) += lib/ +obj-y += log/ obj-$(CONFIG_SANDBOX) += print_ut.o obj-$(CONFIG_SANDBOX) += str_ut.o obj-$(CONFIG_UT_TIME) += time_ut.o obj-$(CONFIG_UT_UNICODE) += unicode_ut.o -obj-y += log/ -obj-$(CONFIG_UNIT_TEST) += lib/ +obj-$(CONFIG_UNIT_TEST) += ut.o From patchwork Sat Oct 3 15:25:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376284 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KvPnMXqZ; 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 4C3W1s31Prz9sS8 for ; Sun, 4 Oct 2020 01:27:12 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 133D5823A7; Sat, 3 Oct 2020 17:26:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KvPnMXqZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EDE5F82374; Sat, 3 Oct 2020 17:26:04 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 5965982351 for ; Sat, 3 Oct 2020 17:26:01 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id z25so4660251iol.10 for ; Sat, 03 Oct 2020 08:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wfWz4PpfPSd9sjnyTadcOTw/jVlmDamEc1zeucTIMag=; b=KvPnMXqZCPKlcDlVKjQ50kh0AEq6ilOSeKS+3oig8WSR4zJF5SZ6ImddK2u06k2Kd4 +3i2DM7g74amFWSuP2G5NLTLAA1rejl2la9XPVs5a+Im3Q2YpxtNYtiCHkmJWxQzkIHu 1uYal6E6COIuKXIsoL1SzzK9wMOVDkBHQDpjQ= 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=wfWz4PpfPSd9sjnyTadcOTw/jVlmDamEc1zeucTIMag=; b=uIdqFmxjqJigAW/7jjLz919ZX1Dix6dZcZui1fkRTc481LCmqyQ6CjYc0HTFxjoQX6 25WoffwTCCMB162+HGsa0/WkhZc8Q6IZKA665c5BjlI3z9SDTxim1hLl+oTuCJPgXFDd a2JigdRHDPuIUI6eLRgNfDyFJi6f+0LAPEwZULf6BdADoiXOikzcynoX8r3q/221y4Nn /TmEskUzc3NRuawpTNyVD4qbZhyjhcEszR+1/B1xreHiDTq9zhnYWHAv82O7IvxfslET O1NkZ+T3B34G2YE2a+jD+M/xlSUqJ8NMhmHfWvmK18rk7ziItoK/GT8qnGKJbWkNUx6N 320w== X-Gm-Message-State: AOAM5303hli+nMOqLnsFqBpIaghvj0K1MUGBtQe1SvCbYHZt1yK97fBY VHtQyB++C5sqjZ3fey4Uc+59uod0g6nYonU4 X-Google-Smtp-Source: ABdhPJzM3GMV1RmlYr/wgMES5y2rP0270EeyvQ6RdKiSG9q499G8/RN+omRvil9RX9u/IXHqKBFLKw== X-Received: by 2002:a5d:8188:: with SMTP id u8mr5974926ion.66.1601738760158; Sat, 03 Oct 2020 08:26:00 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:25:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Marek Vasut , Pavel Herrmann Subject: [PATCH 07/17] dm: test: Update Makefile conditions Date: Sat, 3 Oct 2020 09:25:24 -0600 Message-Id: <20201003152534.3184504-8-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean At present most of the tests in test/Makefile are dependent on CONFIG_SANDBOX. But this is not ideal since they rely on commands being available and SPL does not support commands. Use CONFIG_COMMAND instead. This has the dual purpose of allowing these tests to be used on other boards and allowing SPL to skip them. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/Makefile b/test/Makefile index 13ee661f50e..73bddb4f61f 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,15 +2,15 @@ # # (C) Copyright 2012 The Chromium Authors -obj-$(CONFIG_SANDBOX) += bloblist.o -obj-$(CONFIG_CMDLINE) += cmd/ -obj-$(CONFIG_UNIT_TEST) += cmd_ut.o -obj-$(CONFIG_SANDBOX) += command_ut.o -obj-$(CONFIG_SANDBOX) += compression.o +obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o +obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/ +obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o +obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o +obj-$(CONFIG_$(SPL_)CMDLINE) += compression.o obj-$(CONFIG_UNIT_TEST) += lib/ obj-y += log/ -obj-$(CONFIG_SANDBOX) += print_ut.o -obj-$(CONFIG_SANDBOX) += str_ut.o +obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o +obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o obj-$(CONFIG_UT_TIME) += time_ut.o obj-$(CONFIG_UT_UNICODE) += unicode_ut.o obj-$(CONFIG_UNIT_TEST) += ut.o From patchwork Sat Oct 3 15:25:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376285 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=QyIVrbsD; 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 4C3W276r1Qz9s1t for ; Sun, 4 Oct 2020 01:27:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EF86A8236D; Sat, 3 Oct 2020 17:26:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="QyIVrbsD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B6D238237B; Sat, 3 Oct 2020 17:26:05 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 8461481BF9 for ; Sat, 3 Oct 2020 17:26:02 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id d197so4699388iof.0 for ; Sat, 03 Oct 2020 08:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zm82ua+Jd8DJZGNeDtXNwNPlKTSiFWdzpaTmfJAJfZ0=; b=QyIVrbsD4ZHo8xwWHauJjHA1Kn/ay77dAXB7I5SgZMR54I4nbFtVisK3BUn+oMmbMz R+dtmcOyvZmc+Buj37kZbTMgdWlotSLDg6T0/hTRsIR8eBJPUqaQE/sSefumU4miNuTk 91LCMAMdCtZBAG/vcc0ssToxxsZ+1P1OLYYdM= 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=zm82ua+Jd8DJZGNeDtXNwNPlKTSiFWdzpaTmfJAJfZ0=; b=Tc3dp+eu4IDzioKwLdo0XWL26vXovwaJd5Y3mv0jGBWntR8QKz2Tcb6BIkAB26gUmJ zfeTDqrgAQOMs73ZC2ZxQ4DOjkD7V0du09Ki13YyI3cB/bgf3DtoPFywBMIRdy76kVZB ZmJneBTJWVEcZ47XUuKa2osqXW1/hKPuvjr0RdlB0Mj6raYLpXff1TzMZm6mOQjaucyy X32pUSho9/pCi3gfi50HWmDZQSizIXNta9H/gDd6K4uiw5/Q5i87nh0Sy3WO+F/Tuzm5 o2XLaEWZUTd7z2bgsfoz+fGNS1vkC5HgQFweeJI6qx7HnKWtP78PjdhoPZvfjmBit+qR PF7g== X-Gm-Message-State: AOAM531rgUB5wmbOfQZMzO8BkJygAccOAKTo6fpVayMtTT3IZMp00cCv XSRsn3eUz1u/+GDSsxtBqmc377MDtpfjOe5U X-Google-Smtp-Source: ABdhPJzHdW/ek0h3fet/fe2ZNBVCWLtka3g2AsV3ZmYYnxXjyOrElc9cZ7+Hg/N6ztuX7U47DG+WRQ== X-Received: by 2002:a6b:6309:: with SMTP id p9mr5653253iog.78.1601738761213; Sat, 03 Oct 2020 08:26:01 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:00 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng , Heinrich Schuchardt , Jagan Teki , Marek Vasut , Pavel Herrmann Subject: [PATCH 08/17] dm: test: Make use of CONFIG_UNIT_TEST Date: Sat, 3 Oct 2020 09:25:25 -0600 Message-Id: <20201003152534.3184504-9-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean At present we always include test/dm from the main Makefile. We have a CONFIG_UNIT_TEST that should control whether the test/ directory is built, so rely on that instead. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- Makefile | 2 +- test/Makefile | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 2de0527e2dd..dbe7e7b75c9 100644 --- a/Makefile +++ b/Makefile @@ -806,7 +806,7 @@ libs-$(CONFIG_API) += api/ ifdef CONFIG_POST libs-y += post/ endif -libs-$(CONFIG_UNIT_TEST) += test/ test/dm/ +libs-$(CONFIG_UNIT_TEST) += test/ libs-$(CONFIG_UT_ENV) += test/env/ libs-$(CONFIG_UT_OPTEE) += test/optee/ libs-$(CONFIG_UT_OVERLAY) += test/overlay/ diff --git a/test/Makefile b/test/Makefile index 73bddb4f61f..ed3e882f7a7 100644 --- a/test/Makefile +++ b/test/Makefile @@ -9,8 +9,9 @@ obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += compression.o obj-$(CONFIG_UNIT_TEST) += lib/ obj-y += log/ +obj-y += dm/ obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o obj-$(CONFIG_UT_TIME) += time_ut.o obj-$(CONFIG_UT_UNICODE) += unicode_ut.o -obj-$(CONFIG_UNIT_TEST) += ut.o +obj-y += ut.o From patchwork Sat Oct 3 15:25:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376286 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=KBpGahj/; 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 4C3W2Q2Lvhz9s1t for ; Sun, 4 Oct 2020 01:27:42 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 75416823AA; Sat, 3 Oct 2020 17:26:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="KBpGahj/"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7280382394; Sat, 3 Oct 2020 17:26:06 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x141.google.com (mail-il1-x141.google.com [IPv6:2607:f8b0:4864:20::141]) (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 785DB8232F for ; Sat, 3 Oct 2020 17:26:03 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x141.google.com with SMTP id e5so3934521ils.10 for ; Sat, 03 Oct 2020 08:26:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m0Q2J7ZH7pThmBfj8SiBPbm0YtWne49QWrVBIT/p/vs=; b=KBpGahj/f74sEQOpeUkbx+EYO76QMZ8Hmh9tkP0gH+hLYMJOGDkAYLBR40oQvMt4pO PAMdge/Ej0bBt2jrwk9iUx8/G3RMVqItI5LIU622J7cXIQRKyXNNs/sWd4BfCO7V8kmf U3njIF7B74qnqoVRPc7JKXWxUI4LInje8eQNc= 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=m0Q2J7ZH7pThmBfj8SiBPbm0YtWne49QWrVBIT/p/vs=; b=Js2rHGMqbL013GpK8XzfYQDfu4JY0ykyI9aar3/w/sUq6rIj/Jh31VYt76NnVZpA// 1QWbDRBpNL6+LcE9VIX/h/PTTfvGIH3kzFaxO50m8CpynYDBhrXkqAoP9VeU5rG1KDdz ZX5BX4lEwjGsxryivR3Q8zpNc3SCusJ3zSsOMa5FoMjJ3ASkygA9r2RosBU/pr/AnCVA lOLq5DrAYQo8dQKUZKxHq6PhFG1f+mhjWTeV4SqgD+gL0jXuyUVNpec0HUTVAt/z1nb3 oluSVc18myWAlcoqm/IhE0K3ny176ygQy2Rynt75QIdRiAvbeZTgqLYNeIjKZFmh8rIG LITg== X-Gm-Message-State: AOAM5338UHxick+1Ai4RApn39Hv6jMoPwTIVPRmK4NkYTlhVtuC1kPPC s2N1gO+kizHVa0trnTd8+JGNnicya3AJAqyG X-Google-Smtp-Source: ABdhPJzBcltfjDugh4nPjafbD1+a4YhyneU7ZXPGXdWhwzLymkIGdr/fU+BoX8e/2Vdd8z3WAdVbZw== X-Received: by 2002:a92:5f15:: with SMTP id t21mr5631768ilb.125.1601738762240; Sat, 03 Oct 2020 08:26:02 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:01 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heinrich Schuchardt , Marek Vasut , Pavel Herrmann Subject: [PATCH 09/17] dm: test: Disable some tests that should not run in SPL Date: Sat, 3 Oct 2020 09:25:26 -0600 Message-Id: <20201003152534.3184504-10-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Tests are easier to run in U-Boot proper. Running them in SPL does not add test coverage in most cases. Also some tests use features that are not available in SPL. Update the build rules to disable these tests in SPL. We still need test-main to be able to actually run SPL tests. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Makefile | 9 ++++++--- test/dm/Makefile | 11 +++++++---- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/test/Makefile b/test/Makefile index ed3e882f7a7..c8e554206a5 100644 --- a/test/Makefile +++ b/test/Makefile @@ -7,11 +7,14 @@ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd/ obj-$(CONFIG_$(SPL_)CMDLINE) += cmd_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += command_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += compression.o -obj-$(CONFIG_UNIT_TEST) += lib/ -obj-y += log/ obj-y += dm/ +obj-y += log/ obj-$(CONFIG_$(SPL_)CMDLINE) += print_ut.o obj-$(CONFIG_$(SPL_)CMDLINE) += str_ut.o obj-$(CONFIG_UT_TIME) += time_ut.o -obj-$(CONFIG_UT_UNICODE) += unicode_ut.o obj-y += ut.o + +ifeq ($(CONFIG_SPL_BUILD),) +obj-$(CONFIG_UNIT_TEST) += lib/ +obj-$(CONFIG_$(SPL_)UT_UNICODE) += unicode_ut.o +endif diff --git a/test/dm/Makefile b/test/dm/Makefile index 70ba1b66953..387a4b81410 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -2,15 +2,16 @@ # # Copyright (c) 2013 Google, Inc +obj-$(CONFIG_UT_DM) += test-main.o + +# Tests for particular subsystems - when enabling driver model for a new +# subsystem you must add sandbox tests here. +ifeq ($(CONFIG_SPL_BUILD),) obj-$(CONFIG_UT_DM) += bus.o -obj-$(CONFIG_UT_DM) += nop.o obj-$(CONFIG_UT_DM) += test-driver.o obj-$(CONFIG_UT_DM) += test-fdt.o -obj-$(CONFIG_UT_DM) += test-main.o obj-$(CONFIG_UT_DM) += test-uclass.o -# Tests for particular subsystems - when enabling driver model for a new -# subsystem you must add sandbox tests here. obj-$(CONFIG_UT_DM) += core.o ifneq ($(CONFIG_SANDBOX),) obj-$(CONFIG_ACPIGEN) += acpi.o @@ -35,6 +36,7 @@ obj-$(CONFIG_LED) += led.o obj-$(CONFIG_DM_MAILBOX) += mailbox.o obj-$(CONFIG_DM_MMC) += mmc.o obj-y += fdtdec.o +obj-$(CONFIG_UT_DM) += nop.o obj-y += ofnode.o obj-y += ofread.o obj-$(CONFIG_OSD) += osd.o @@ -82,3 +84,4 @@ obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o obj-$(CONFIG_RESET_SYSCON) += syscon-reset.o obj-$(CONFIG_SCMI_FIRMWARE) += scmi.o endif +endif # !SPL From patchwork Sat Oct 3 15:25:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376288 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=k5ZI1YVx; 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 4C3W3156RVz9s1t for ; Sun, 4 Oct 2020 01:28:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 60E21823BE; Sat, 3 Oct 2020 17:26:15 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="k5ZI1YVx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A24188237B; Sat, 3 Oct 2020 17:26:07 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 B90FC8236D for ; Sat, 3 Oct 2020 17:26:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id d197so4699433iof.0 for ; Sat, 03 Oct 2020 08:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=plvqHOC8ZSsDcgIcQ5VNAYTyOtWeYJu5PgyuSefWy8A=; b=k5ZI1YVxuuqafjrs5cEacURIZEy+IJOvme4MsZ3h3NgiOWAv8wUO64ZG7o2nrZdTcQ sGzGlBS3xZtuRg1qh7TmyY+Xft3TNOjtcJ8u0UriJZ2+xTY6vT2wo9NzL7sslxW3kE0D iPb7fL+HzOH5bchliR1L2W1shMvXLqftHMWdA= 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=plvqHOC8ZSsDcgIcQ5VNAYTyOtWeYJu5PgyuSefWy8A=; b=B9Z2dN3exhlhMnso3vTJEcj0sdyCilzKIa0zbJo3doSSnChrVxgZf3HKXS7ncQZZ1L ZO2yjkh71qkEaOwCSYn8JtZvja9bGzMFd+aNCQ7qqFaDBk4C51bebTB5o7WACoRQhso+ wPh7SyH4Ru6CLhAR5DtZSLhejFdpDCvhVk9FXC5KbQrU4xCujBY8csA+1d//rZs9Ca7K zmlCkh3SucN8iPGP/5dQTLVqaR9nlfYJWlifVbkY1kDDFU8BP2wz/ML1fapgZN//fQEh xjIFaonzWyuPdfIFrt5YozsHiFYQdhBi5fuZXeQgN9pHGABJbUWeV74xQJ1hCPcA4kcG 29sw== X-Gm-Message-State: AOAM532WMvQNGYfj2T7VYYCiJaDGCoozn9/i0LZDW0stZylgq3ZyD9L0 jJH3vUePqkTD2fNAPLqv//drZj0v7sUMT2QJ X-Google-Smtp-Source: ABdhPJxGENXY0XtZrpQPepT/h4i8zg1AC6vahBops8bCWAMeDwdvpli2LVC8t1ooIZ7BoNLz8mXy+w== X-Received: by 2002:a5d:914a:: with SMTP id y10mr5751899ioq.108.1601738763492; Sat, 03 Oct 2020 08:26:03 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:03 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , AKASHI Takahiro , Heiko Stuebner , Heinrich Schuchardt , Jan Kiszka , Kever Yang , Marek Vasut , Masahiro Yamada , Pavel Herrmann , Vignesh Raghavendra Subject: [PATCH 10/17] dm: test: Build tests for SPL Date: Sat, 3 Oct 2020 09:25:27 -0600 Message-Id: <20201003152534.3184504-11-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean We want to run unit tests in SPL. Add a new Kconfig to control this and enable it for sandbox_spl Signed-off-by: Simon Glass --- configs/sandbox_spl_defconfig | 2 +- scripts/Makefile.spl | 1 + test/Kconfig | 10 ++++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/configs/sandbox_spl_defconfig b/configs/sandbox_spl_defconfig index 6d8e827aebc..49060cab7a3 100644 --- a/configs/sandbox_spl_defconfig +++ b/configs/sandbox_spl_defconfig @@ -22,7 +22,6 @@ CONFIG_BOOTSTAGE_STASH=y CONFIG_BOOTSTAGE_STASH_SIZE=0x4096 CONFIG_CONSOLE_RECORD=y CONFIG_CONSOLE_RECORD_OUT_SIZE=0x1000 -CONFIG_SILENT_CONSOLE=y CONFIG_DISPLAY_BOARDINFO_LATE=y CONFIG_HANDOFF=y CONFIG_SPL_BOARD_INIT=y @@ -220,5 +219,6 @@ CONFIG_TPM=y CONFIG_LZ4=y CONFIG_ERRNO_STR=y CONFIG_UNIT_TEST=y +CONFIG_SPL_UNIT_TEST=y CONFIG_UT_TIME=y CONFIG_UT_DM=y diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index d528c994ff2..2e3a443035c 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -99,6 +99,7 @@ libs-y += dts/ libs-y += fs/ libs-$(CONFIG_SPL_POST_MEM_SUPPORT) += post/drivers/ libs-$(CONFIG_SPL_NET_SUPPORT) += net/ +libs-$(CONFIG_SPL_UNIT_TEST) += test/ head-y := $(addprefix $(obj)/,$(head-y)) libs-y := $(addprefix $(obj)/,$(libs-y)) diff --git a/test/Kconfig b/test/Kconfig index 28704a25b61..2646e7d825a 100644 --- a/test/Kconfig +++ b/test/Kconfig @@ -6,6 +6,16 @@ menuconfig UNIT_TEST This does not require sandbox to be included, but it is most often used there. +config SPL_UNIT_TEST + bool "Unit tests in SPL" + # We need to be able to unbind devices for tests to work + select SPL_DM_DEVICE_REMOVE + help + Select this to enable unit tests in SPL. Most test are designed for + running in U-Boot proper, but some are intended for SPL, such as + of-platdata and SPL handover. To run these tests with the sandbox_spl + board, use the -u (unit test) option. + config UT_LIB bool "Unit tests for library functions" depends on UNIT_TEST From patchwork Sat Oct 3 15:25:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376289 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=g1xeKQeA; 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 4C3W3M1Vpzz9s1t for ; Sun, 4 Oct 2020 01:28:30 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A1342823C4; Sat, 3 Oct 2020 17:26:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g1xeKQeA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1E1E98239D; Sat, 3 Oct 2020 17:26:09 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 AE2AF82385 for ; Sat, 3 Oct 2020 17:26:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id k25so4673007ioh.7 for ; Sat, 03 Oct 2020 08:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=JF8eBIlMk8RVmc8Z8Dz2/5uZCwn2t2PfCY7z/LVACEQ=; b=g1xeKQeA0AdFKu4u/LIXvwfYnskBfpXQ/u/RgA+pQ4d702/xDh4J0xbxl+kg94GziR aKbi7qHldbLZz9mY+AuNnsFshj3oxsGq+qn5+u7mfj1gWEuUgGwUQOydP17dIkHjMiSp 1CFs2yQABYIwTVmFJhTtBVCG6XGChI+FlEmJg= 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=JF8eBIlMk8RVmc8Z8Dz2/5uZCwn2t2PfCY7z/LVACEQ=; b=ttFmpM+20ec8Y12YOjhLrdiVLhWfZ8VGVb9yrjy97pv8gIbzRnv7BUs6eTSs0zkXNe TPtHy87fr+TezH6VwfGuFU7LcFhNDamNW1Kwqx6IlzIBwhZiisnxc8gyqjwuIXItrDDo av+HTdOvU0b8vsvlQ9vXd/0wQwPBjiX7Ik5YQgqvynMzpGWLEtUznwHHA6v5gfUh2geN uAuV/iwEImcULHPRxlzu8H7690+nBDr04PIKBiCArVsQCOT7lG0q9Axw86KT901/XgPV Oa6MSMjE07B82URhyEwBoNVdM/T4u5mLqzs1rGJhlDuSJha6i98bUGzjJGeVlMHk3Ck5 2aOg== X-Gm-Message-State: AOAM530alMzRrWVamQI1ntvNIRunwAuVyQ93SSc4HGF/BLGJ6LkdJuTX fpLvX7txlTAI3nVb3emKNF1P/puteMUvfonl X-Google-Smtp-Source: ABdhPJz4sTpkO2RrlaJtmOU3j8wC+rkL9C9h0VO3ftSiB78QEgP+7Zp1l0mIxinZpXDtnSV9N9QDdg== X-Received: by 2002:a05:6638:587:: with SMTP id a7mr6466152jar.72.1601738764494; Sat, 03 Oct 2020 08:26:04 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:04 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 11/17] dm: test: Update the test runner to support of-platdata Date: Sat, 3 Oct 2020 09:25:28 -0600 Message-Id: <20201003152534.3184504-12-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean At present DM tests assume that a devicetree is available. This is not the case with of-platadata. Update the code to add this condition. Signed-off-by: Simon Glass --- test/dm/test-main.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 995988723ae..5560572c7c6 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -30,7 +30,8 @@ static int dm_test_init(struct unit_test_state *uts, bool of_live) memset(dms, '\0', sizeof(*dms)); gd->dm_root = NULL; - memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count)); + if (!CONFIG_IS_ENABLED(OF_PLATDATA)) + memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count)); state_reset_for_test(state_get_current()); /* Determine whether to make the live tree available */ @@ -91,7 +92,8 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, ut_assertok(dm_scan_platdata(false)); if (test->flags & UT_TESTF_PROBE_TEST) ut_assertok(do_autoprobe(uts)); - if (test->flags & UT_TESTF_SCAN_FDT) + if (!CONFIG_IS_ENABLED(OF_PLATDATA) && + (test->flags & UT_TESTF_SCAN_FDT)) ut_assertok(dm_extended_scan_fdt(gd->fdt_blob, false)); /* @@ -136,14 +138,16 @@ static int dm_test_main(const char *test_name) uts->priv = &_global_priv_dm_test_state; uts->fail_count = 0; - /* - * If we have no device tree, or it only has a root node, then these - * tests clearly aren't going to work... - */ - if (!gd->fdt_blob || fdt_next_node(gd->fdt_blob, 0, NULL) < 0) { - puts("Please run with test device tree:\n" - " ./u-boot -d arch/sandbox/dts/test.dtb\n"); - ut_assert(gd->fdt_blob); + if (!CONFIG_IS_ENABLED(OF_PLATDATA)) { + /* + * If we have no device tree, or it only has a root node, then + * these * tests clearly aren't going to work... + */ + if (!gd->fdt_blob || fdt_next_node(gd->fdt_blob, 0, NULL) < 0) { + puts("Please run with test device tree:\n" + " ./u-boot -d arch/sandbox/dts/test.dtb\n"); + ut_assert(gd->fdt_blob); + } } if (!test_name) @@ -192,7 +196,8 @@ static int dm_test_main(const char *test_name) gd->dm_root = NULL; ut_assertok(dm_init(CONFIG_IS_ENABLED(OF_LIVE))); dm_scan_platdata(false); - dm_scan_fdt(gd->fdt_blob, false); + if (!CONFIG_IS_ENABLED(OF_PLATDATA)) + dm_scan_fdt(gd->fdt_blob, false); return uts->fail_count ? CMD_RET_FAILURE : 0; } From patchwork Sat Oct 3 15:25:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376290 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=I+G8lRIa; 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 4C3W3g2mhqz9s1t for ; Sun, 4 Oct 2020 01:28:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B2583823CF; Sat, 3 Oct 2020 17:26:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="I+G8lRIa"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 182EF8239D; Sat, 3 Oct 2020 17:26:10 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd42.google.com (mail-io1-xd42.google.com [IPv6:2607:f8b0:4864:20::d42]) (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 D9B2281BF9 for ; Sat, 3 Oct 2020 17:26:06 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd42.google.com with SMTP id k25so4673034ioh.7 for ; Sat, 03 Oct 2020 08:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XxfoXkxglP4tibD1zWeGfZ/4wvHWkoaFl+iJqCRKNKU=; b=I+G8lRIasELjRjYLNY/xqv/+Lb6A9lz966iNnlRebny8MxM6a8PbgQ29L0ImoWHn2e tcyu7aUy2CjX5BqZA3hi3X4WQx6IoDjefB3/VGeaiw3twnb/jnAZp8pMGcn9TwZZEYCL TKeH1FaREE42lleDF4iF015Zuvtd0NIZHeBMQ= 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=XxfoXkxglP4tibD1zWeGfZ/4wvHWkoaFl+iJqCRKNKU=; b=cqgOFA85mfZucvCFIwROe9KpaZlBogwJ8YiF1/m4SOfst3A3xF9nQQ/vVu8mdv9HIp 2aPZnG4Td2yawA+0kt+i2S599m2YhKE64yuRM5YJ6gw2CTlZBHjqkFYe4jQr47b+d4Hk iViqjqWxSUddfh43T6KPViZDDdYsVGMGPc7WImfyyUWJV/0TGZiZZbR8unimtmfey5sx 8dvSs3q1jbbpgmHaeUStMGO36dNxJsBJlb1oF7KGacNYeT9hrgR9WzieGmSbIPa+CL97 ZY0wZFv5k1Smvh//bg41r52YIC6q5lZoHWtgmD8ZSn0d7ogOm27F8E5G5wK2DumKyUyE BbVA== X-Gm-Message-State: AOAM532NCpeZHu2g+8cncgM3RzuD0eM29A7aoH1dOKpyBsYu8G6izmui kLMXeQNdsZOCqPLWIaAA+w/C/2rdM9h4GVuy X-Google-Smtp-Source: ABdhPJyoh4+cd86sn/ai9MyZC0+dA9s9+bRZatrkmZfscLx6vgSA56SM2ml9g6GjLRCXBPvWCdNZ8A== X-Received: by 2002:a02:c785:: with SMTP id n5mr2147813jao.128.1601738765660; Sat, 03 Oct 2020 08:26:05 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:05 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Anatolij Gustschin , Bin Meng , Heinrich Schuchardt , Marek Vasut , Pavel Herrmann , Sean Anderson , Stephen Warren Subject: [PATCH 12/17] dm: test: Add a way to run SPL tests Date: Sat, 3 Oct 2020 09:25:29 -0600 Message-Id: <20201003152534.3184504-13-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Add a -u flag for U-Boot SPL which requests that unit tests be run. To make this work, export dm_test_main() and update it to skip test features that are not used with of-platdata. To run the tests: $ spl/u-boot-spl -u U-Boot SPL 2020.10-rc5 (Oct 01 2020 - 07:35:39 -0600) Running 0 driver model tests Failures: 0 At present there are no SPL unit tests. Note that there is one wrinkle with these tests. SPL has limited memory available for allocation. Also malloc_simple does not free memory (free() is a nop) and running tests repeatedly causes driver-model to reinit multiple times and allocate memory. Therefore it is not possible to run more than a few tests at a time. One solution is to increase the amount of malloc space in sandbox_spl. This is not a problem for pytest, since it runs each test individually, so for now this is left as is. Signed-off-by: Simon Glass --- arch/sandbox/cpu/spl.c | 8 ++++++++ arch/sandbox/cpu/start.c | 9 +++++++++ arch/sandbox/include/asm/state.h | 1 + include/test/test.h | 11 +++++++++++ test/dm/test-main.c | 2 +- 5 files changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c index 7ab8919eb90..48fd1265afe 100644 --- a/arch/sandbox/cpu/spl.c +++ b/arch/sandbox/cpu/spl.c @@ -12,6 +12,7 @@ #include #include #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -67,6 +68,13 @@ void spl_board_init(void) uclass_next_device(&dev)) ; } + + if (state->run_unittests) { + int ret; + + ret = dm_test_main(NULL); + /* continue execution into U-Boot */ + } } void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image) diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index c6a2bbe4689..f5e104b127b 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -374,6 +374,15 @@ static int sandbox_cmdline_cb_show_of_platdata(struct sandbox_state *state, } SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL"); +static int sandbox_cmdline_cb_unittests(struct sandbox_state *state, + const char *arg) +{ + state->run_unittests = true; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(unittests, 'u', 0, "Run unit tests"); + static void setup_ram_buf(struct sandbox_state *state) { /* Zero the RAM buffer if we didn't read it, to keep valgrind happy */ diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 1bfad305f1a..f828d9d2447 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -92,6 +92,7 @@ struct sandbox_state { int default_log_level; /* Default log level for sandbox */ bool show_of_platdata; /* Show of-platdata in SPL */ bool ram_buf_read; /* true if we read the RAM buffer */ + bool run_unittests; /* Run unit tests */ /* Pointer to information for each SPI bus/cs */ struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS] diff --git a/include/test/test.h b/include/test/test.h index 67c7d69d488..03e29290bf4 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -94,4 +94,15 @@ enum { TEST_DEVRES_SIZE3 = 37, }; +/** + * dm_test_main() - Run driver model tests + * + * Run all the available driver model tests, or a selection + * + * @test_name: Name of single test to run (e.g. "dm_test_fdt_pre_reloc" or just + * "fdt_pre_reloc"), or NULL to run all + * @return 0 if all tests passed, 1 if not + */ +int dm_test_main(const char *test_name); + #endif /* __TEST_TEST_H */ diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 5560572c7c6..9d22df8c4dc 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -127,7 +127,7 @@ static bool dm_test_run_on_flattree(struct unit_test *test) return !strstr(fname, "video") || strstr(test->name, "video_base"); } -static int dm_test_main(const char *test_name) +int dm_test_main(const char *test_name) { struct unit_test *tests = ll_entry_start(struct unit_test, dm_test); const int n_ents = ll_entry_count(struct unit_test, dm_test); From patchwork Sat Oct 3 15:25:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376291 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=cOlhpFIH; 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 4C3W3z4dPzz9sS8 for ; Sun, 4 Oct 2020 01:29:03 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AF00B823DD; Sat, 3 Oct 2020 17:26:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="cOlhpFIH"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8743C8237B; Sat, 3 Oct 2020 17:26:10 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 C54528236D for ; Sat, 3 Oct 2020 17:26:07 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd43.google.com with SMTP id m17so4694913ioo.1 for ; Sat, 03 Oct 2020 08:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KRRKQE8eXPkSBgfwQVcWakdRLmz79AZZZ29W5hlDLBQ=; b=cOlhpFIHXHhSHFmAY7Eb8V3texmt77LmSRSXNX5nGZVhuEPndV4yXeNPP9+DGp50vM KrFxW7nUP7WiVySL+DM+ogLsrXMuHq/NlXiJe7m+ZKSEnUFZxUsbwczN62SQ0reMOpF6 eKHGvLb/nF5oXc3IpOnKkAKEwDOScnVye/eSg= 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=KRRKQE8eXPkSBgfwQVcWakdRLmz79AZZZ29W5hlDLBQ=; b=dXbt/mtX37kogrhRfr6nMjTgbXfysnhrxF75ovcrR8UR7gz57vE3deNU0Abqvy4Ydd rGUEvOXI9iv4Z/CZqw6KCNo6Xn44kgzuo95Z1KKg4/04HEwKbLugatjn3UcOvOcQy9cO DOwiBEz5OtdHVXF50pXGKVskwfm11iIOJe1Y8JtZlz0hC38FUEy6+UjC4lQIyxuWFOjI +0VyhWEy8pD9mvIgsY7PsDX27lJuDmUfedunUbgqedz7xlYSk6eUeqrZoyFkUxPFhnR3 3asPPkVHXBGEXiHSPMESeFRoIy3GmgsBiRxkvt54oe1cV6ieZPM3ijsx+THsSz+4Gkiz AoKw== X-Gm-Message-State: AOAM5306ReHvrWHG4ug9VsFKnbCtCrbxwUcIb9Mn6ei1CJyVm56LQPbW pRicgehSg/JtCDuXbgputwPmnDCYJ7W6ewVT X-Google-Smtp-Source: ABdhPJx4V1scNbZWOa+R3V0YR2S3rHRKKFtHcNynAGvYvR+lg9t8Jy+OAQCllz1kGZmGCQc1PfBwiA== X-Received: by 2002:a5d:8b8e:: with SMTP id p14mr5737435iol.171.1601738766572; Sat, 03 Oct 2020 08:26:06 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 13/17] dm: test: Add a very simple of-platadata test Date: Sat, 3 Oct 2020 09:25:30 -0600 Message-Id: <20201003152534.3184504-14-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean At present we have a pytest that covers of-platadata. Add a very simple unit test that just checks that a device can be found. This shows the ability to write these tests in C. Signed-off-by: Simon Glass --- test/dm/Makefile | 4 +++- test/dm/of_platdata.c | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 test/dm/of_platdata.c diff --git a/test/dm/Makefile b/test/dm/Makefile index 387a4b81410..620cdc5f2b4 100644 --- a/test/dm/Makefile +++ b/test/dm/Makefile @@ -6,7 +6,9 @@ obj-$(CONFIG_UT_DM) += test-main.o # Tests for particular subsystems - when enabling driver model for a new # subsystem you must add sandbox tests here. -ifeq ($(CONFIG_SPL_BUILD),) +ifeq ($(CONFIG_SPL_BUILD),y) +obj-$(CONFIG_SPL_OF_PLATDATA) += of_platdata.o +else obj-$(CONFIG_UT_DM) += bus.o obj-$(CONFIG_UT_DM) += test-driver.o obj-$(CONFIG_UT_DM) += test-fdt.o diff --git a/test/dm/of_platdata.c b/test/dm/of_platdata.c new file mode 100644 index 00000000000..7a864eb0fb3 --- /dev/null +++ b/test/dm/of_platdata.c @@ -0,0 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ + +#include +#include +#include +#include +#include + +/* Test that we can find a device using of-platdata */ +static int dm_test_of_platdata_base(struct unit_test_state *uts) +{ + struct udevice *dev; + + ut_assertok(uclass_first_device_err(UCLASS_SERIAL, &dev)); + ut_asserteq_str("sandbox_serial", dev->name); + + return 0; +} +DM_TEST(dm_test_of_platdata_base, UT_TESTF_SCAN_PDATA); From patchwork Sat Oct 3 15:25:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376292 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=g5r3UkQI; 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 4C3W4G02fKz9sS8 for ; Sun, 4 Oct 2020 01:29:17 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2FC13823EA; Sat, 3 Oct 2020 17:26:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g5r3UkQI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3DD79823AD; Sat, 3 Oct 2020 17:26:12 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd44.google.com (mail-io1-xd44.google.com [IPv6:2607:f8b0:4864:20::d44]) (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 8B59B82351 for ; Sat, 3 Oct 2020 17:26:09 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd44.google.com with SMTP id m17so4694957ioo.1 for ; Sat, 03 Oct 2020 08:26:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5HeWNByT1xsu4lyNWRBvU/GIrF70wGaAZVgThVIfP20=; b=g5r3UkQI0M1tdvH70CKyUa5nKqzX/Y3ehWCYRH7sl+hsPNL7oJn0sRlYVCwluxEFbU /I61Wx6hQztz2vOBV8Sy2VRr1P0ZgYMj3clJVdDCJAfp/mD9tvWXAUiA+096a7+eEMEk APafavHy2JE6RcnPthEjcceB4zOm3DpLPCcE0= 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=5HeWNByT1xsu4lyNWRBvU/GIrF70wGaAZVgThVIfP20=; b=ZCKqy2aFmfd3gIUYTfkAgXf8ERSLP1FHHyzlzNULC0/X4UHfLr0vDFLjP4Yr+KAPr6 ixFu43cRFp5XFB88Z+rqzvuyWRReoVAhmos4dFWTY/QkcnnixFnaxjz/ONSTQdNR3Ctp xVq/B7WKDFRdy9zu5MuuRasn5K3OqVof1JpmKH+WxG+pqRVmeMZVwSxKjFjB9yeMpGjE LFTdMkHkMpMRmjxFkjqFFxCI0KkovQUgpd+C9qtmnupTJxPJj1K8SgajMcpb5MjVXNVd laVlcAYii11IwHlyUhLyZ76iNnxI8a8V3k+Vie+NSDi55CPP2Ty0PGM+myE8TFEEs7dB aWsw== X-Gm-Message-State: AOAM533O3hmEvZ00ra0jOsARc+9toNkjW1Mw7iW9O0Lg8xb7yrqEfClC SuQqbielNnKTrsi1YXUxVTNoiSRkyqBegj9A X-Google-Smtp-Source: ABdhPJwzKmCNuWKwLc2MwmFrbj0vf0EvFlSemBOBODfO5/YvgbPy29pScnUCRkQKfySay2Hqt+qFMQ== X-Received: by 2002:a6b:ec04:: with SMTP id c4mr5879079ioh.179.1601738768123; Sat, 03 Oct 2020 08:26:08 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:07 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Heiko Stuebner , Jan Kiszka , Jean-Jacques Hiblot , Masahiro Yamada , Masahiro Yamada , Vignesh Raghavendra Subject: [PATCH 14/17] Makefile: Generate a symbol file for u-boot-spl Date: Sat, 3 Oct 2020 09:25:31 -0600 Message-Id: <20201003152534.3184504-15-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Add a rule to generate u-boot-spl.sym so that pytest can discover the available unit tests. Signed-off-by: Simon Glass --- scripts/Makefile.spl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 2e3a443035c..9f1f7445d71 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -214,7 +214,7 @@ spl/boot.bin: $(obj)/$(SPL_BIN)-align.bin FORCE $(call if_changed,mkimage) endif -INPUTS-y += $(obj)/$(SPL_BIN).bin +INPUTS-y += $(obj)/$(SPL_BIN).bin $(obj)/$(SPL_BIN).sym ifdef CONFIG_SAMSUNG INPUTS-y += $(obj)/$(BOARD)-spl.bin @@ -408,6 +408,11 @@ MKIMAGEFLAGS_u-boot-spl-mtk.bin = -T mtk_image \ $(obj)/u-boot-spl-mtk.bin: $(obj)/u-boot-spl.bin FORCE $(call if_changed,mkimage) +quiet_cmd_sym ?= SYM $@ + cmd_sym ?= $(OBJDUMP) -t $< > $@ +$(obj)/$(SPL_BIN).sym: $(obj)/$(SPL_BIN) FORCE + $(call if_changed,sym) + # Rule to link u-boot-spl # May be overridden by arch/$(ARCH)/config.mk quiet_cmd_u-boot-spl ?= LD $@ From patchwork Sat Oct 3 15:25:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376293 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=HXHTnPEk; 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 4C3W4R4V3pz9s1t for ; Sun, 4 Oct 2020 01:29:27 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5E367823F5; Sat, 3 Oct 2020 17:26:21 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="HXHTnPEk"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5D581823B3; Sat, 3 Oct 2020 17:26:13 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd34.google.com (mail-io1-xd34.google.com [IPv6:2607:f8b0:4864:20::d34]) (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 7666D8237C for ; Sat, 3 Oct 2020 17:26:10 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd34.google.com with SMTP id u6so4672839iow.9 for ; Sat, 03 Oct 2020 08:26:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y7zCXtZhMBvcucpPpL5y+c/o02F9tgTlIkAIjIx/bkg=; b=HXHTnPEk1i0ueOApC9srxcXtqUO+WbTyRIDmDyVTNwJS6jsU8G3uen+p5D+zvN65oZ FHKxh+duBn1PEnKi9ZB63hU8JjcBvxriJJt8LunCfkbqGvyfsd6Xvd1U6t7vK6sXIGpf e/tOI3KN8z4oWbVLOXLvtii+/L/sxU/yrgCro= 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=y7zCXtZhMBvcucpPpL5y+c/o02F9tgTlIkAIjIx/bkg=; b=Zti6wEzFxY8F+s9wzxyO/ivDm7adFTH8XecCRgeLyh93OW8UNNq55W5VfDlEImhTyp RJeaHJsKesbRdo2dUY4bpVhg2JH4F8FqYS1lBR3bjWcsimoZi5ozgVgraA97N1ZPSoP4 mn283+abjf7/N1D1xZp4hLTCWX23rCSqY9do5lpF2XIaeEpaqIgaldlAcUvNS5EN4CnF dW/0EwkR894P+I/itNA3hyuK1FlV+DR0wF8h7BzPcVPTFKMzar+q0TgqFZ403mC1F2hk J5x1/MLc0ecYlTAAUzB6FQDd/xbFvjtw9TNzkvtxtdnoCGj3Z21m0LN375OQWARneoUZ KfxQ== X-Gm-Message-State: AOAM533ddlbKsxVB5QSPPtKXV6SzdeBBPhtrQkJFpJZc85xvU77shOtP oGQGX+CuVD1eBD2s+yFyRLXublMhoKKnTIIE X-Google-Smtp-Source: ABdhPJxoYiBWd3ltSix+PR4qsUf9O+Znzky204YK78NZHoF2fcUWkJlcYC3kbJ55ATdpp14SeBsRhQ== X-Received: by 2002:a05:6602:189:: with SMTP id m9mr5639706ioo.74.1601738769173; Sat, 03 Oct 2020 08:26:09 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:08 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Cristian Ciocaltea , Heinrich Schuchardt , Marek Vasut , Stephen Warren Subject: [PATCH 15/17] pytest: Collect SPL unit tests Date: Sat, 3 Oct 2020 09:25:32 -0600 Message-Id: <20201003152534.3184504-16-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Add a new test_spl fixture to handle running SPL unit tests. Signed-off-by: Simon Glass --- test/py/conftest.py | 14 +++++++++----- test/py/tests/test_spl.py | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 test/py/tests/test_spl.py diff --git a/test/py/conftest.py b/test/py/conftest.py index 30920474b36..28fde347c00 100644 --- a/test/py/conftest.py +++ b/test/py/conftest.py @@ -227,7 +227,7 @@ def pytest_configure(config): console = u_boot_console_exec_attach.ConsoleExecAttach(log, ubconfig) re_ut_test_list = re.compile(r'_u_boot_list_2_(.*)_test_2_\1_test_(.*)\s*$') -def generate_ut_subtest(metafunc, fixture_name): +def generate_ut_subtest(metafunc, fixture_name, sym_path): """Provide parametrization for a ut_subtest fixture. Determines the set of unit tests built into a U-Boot binary by parsing the @@ -237,12 +237,13 @@ def generate_ut_subtest(metafunc, fixture_name): Args: metafunc: The pytest test function. fixture_name: The fixture name to test. + sym_path: Relative path to the symbol file with preceding '/' + (e.g. '/u-boot.sym') Returns: Nothing. """ - - fn = console.config.build_dir + '/u-boot.sym' + fn = console.config.build_dir + sym_path try: with open(fn, 'rt') as f: lines = f.readlines() @@ -317,10 +318,13 @@ def pytest_generate_tests(metafunc): Returns: Nothing. """ - + #print('name', metafunc.fixturenames) for fn in metafunc.fixturenames: if fn == 'ut_subtest': - generate_ut_subtest(metafunc, fn) + generate_ut_subtest(metafunc, fn, '/u-boot.sym') + continue + if fn == 'ut_spl_subtest': + generate_ut_subtest(metafunc, fn, '/spl/u-boot-spl.sym') continue generate_config(metafunc, fn) diff --git a/test/py/tests/test_spl.py b/test/py/tests/test_spl.py new file mode 100644 index 00000000000..58a851e5ec8 --- /dev/null +++ b/test/py/tests/test_spl.py @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright 2020 Google LLC +# Written by Simon Glass + +import os.path +import pytest + +def test_spl(u_boot_console, ut_spl_subtest): + """Execute a "ut" subtest. + + The subtests are collected in function generate_ut_subtest() from linker + generated lists by applying a regular expression to the lines of file + spl/u-boot-spl.sym. The list entries are created using the C macro + UNIT_TEST(). + + Strict naming conventions have to be followed to match the regular + expression. Use UNIT_TEST(foo_test_bar, _flags, foo_test) for a test bar in + test suite foo that can be executed via command 'ut foo bar' and is + implemented in C function foo_test_bar(). + + Args: + u_boot_console (ConsoleBase): U-Boot console + ut_subtest (str): test to be executed via command ut, e.g 'foo bar' to + execute command 'ut foo bar' + """ + cons = u_boot_console + cons.restart_uboot_with_flags(['-u', ut_spl_subtest]) + output = cons.get_spawn_output().replace('\r', '') + assert 'Failures: 0' in output From patchwork Sat Oct 3 15:25:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376294 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=g4sCbTUY; 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 4C3W4d2gT4z9s1t for ; Sun, 4 Oct 2020 01:29:37 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AEF84823E1; Sat, 3 Oct 2020 17:26:22 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="g4sCbTUY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CE7BC823AF; Sat, 3 Oct 2020 17:26:13 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) (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 58147823A9 for ; Sat, 3 Oct 2020 17:26:11 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd41.google.com with SMTP id m17so4695023ioo.1 for ; Sat, 03 Oct 2020 08:26:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bp8c60VN2PqLFFo9UC4o2gP4DO1a0VzfSjtoniUyXGo=; b=g4sCbTUY0fQX0V+JTZhGHQzwhFGL1ttqP8h4aBKEd5hIlpO8GEmbnWtv1v3WwCCqiq iXDFRwQRgd/DsKh//Eg7DbkaaR83Awv1a9Y4DpAOHcdu6vvjpBSqKde/R4ozWR0Wgdv5 TGHn8vaAtCKyc5YEvGwE8BGpsMo+rS+vRsJeA= 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=bp8c60VN2PqLFFo9UC4o2gP4DO1a0VzfSjtoniUyXGo=; b=tnwGRi2onlk+BM8AgIUqoLHv5W/cOnExdkHUip9zuLPvwnxrQMjywIaT1VunqSO0n2 WIIOUJyu4cB07C6wqycVBYCht+Zt9su345ZPOAJrH6S7u/ooTrAkJLYMLNrPhthJ92O1 esq80XgY5nu8DjzzC+jCUJDtpCPKf/T6odTD/zB2rJal1MOkCpZYi120JzKLfq1oIxIx rfM4w8QpsK1qdPuk28laU39FshRZxKsUXaykjcPqP7K1muW5hEWQXJpZnnrgDmXQ6UJp F3J4zPVNNWg/aiT9dPVwyqFt1sR8TQftAW1AL/DM/wMewwR3wFKjUinnVMZeREu4CD70 OxYg== X-Gm-Message-State: AOAM531ybt6xOoGrpjpFCiYmA66yGTEU+cSoKrZZdnS/G1d+VSsGjNM8 JABqHSXh5b0mJ52cqFXHQnZNc0wY5LaFovuJ X-Google-Smtp-Source: ABdhPJydti4UHXIy0iGBTJTfPW1n8V3hwPkhTzHkzp/ctXL/fRU+5B92yZJwqqnYab4II0yTlPkYbQ== X-Received: by 2002:a05:6602:38d:: with SMTP id f13mr5708017iov.6.1601738770074; Sat, 03 Oct 2020 08:26:10 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:09 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 16/17] test: Run SPL unit tests Date: Sat, 3 Oct 2020 09:25:33 -0600 Message-Id: <20201003152534.3184504-17-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Update the 'run' script to include SPL unit tests. Signed-off-by: Simon Glass --- test/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run b/test/run index de87e7530b1..735628e7e37 100755 --- a/test/run +++ b/test/run @@ -28,7 +28,7 @@ fi # Run tests which require sandbox_spl run_test "sandbox_spl" ./test/py/test.py --bd sandbox_spl --build \ - -k 'test_ofplatdata or test_handoff' + -k 'test_ofplatdata or test_handoff or test_spl' if [ -z "$tools_only" ]; then # Run tests for the flat-device-tree version of sandbox. This is a special From patchwork Sat Oct 3 15:25:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1376295 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=chromium.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=IUlLxrFc; 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 4C3W4q2Kr2z9s1t for ; Sun, 4 Oct 2020 01:29:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3562782400; Sat, 3 Oct 2020 17:26:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="IUlLxrFc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4A6D0823AD; Sat, 3 Oct 2020 17:26:15 +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,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (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 8C9F8823AD for ; Sat, 3 Oct 2020 17:26:12 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id z25so4660579iol.10 for ; Sat, 03 Oct 2020 08:26:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C4RVYz4Pzuwk6AaBkevinO1qI7y7Bjy8uw3Ly70NZ6I=; b=IUlLxrFc+Ayl1U4Mje5IVyu9mGtSR1w8Ppthg3sQcXxG+T/c6DW0efxS0I4WHkw3VV pZIbnAHj1QYloSdUkEoBWK7WGnyM6yFlMaQCOqha26UAGFnEvMC4rBnMuGWaEwo6PDUO 2v6A3yQeQQ8pIU44j6i+c8xoGW5zLOLyEMKGM= 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=C4RVYz4Pzuwk6AaBkevinO1qI7y7Bjy8uw3Ly70NZ6I=; b=UYot5MuUafuhe5Q9CUWALj5nffvjXmdd1lx5tQV2/xQfPJ/xKGanDDvyJrq1Q8PCda seM5co1yB0YqWDNbrRshAyZvg1lz07MagEGDDsnaKe1kNiKagJ265wNJzUbCAJp/IwXE Bz8+v8Q1QHMZxug10B2t5ky/2lyxzztGSOUDz4q94b0UN5fTSU/vF42DgAMsDqnSN8bL qsnPzfD7qDcP5RleJkZ5aDcLEbj5XNgAXjEyYKy+DwcIfJMNyTxIX4FWpR25EAQtl2lL I9iwYmny02Tugeda0lm0cNcQY3uqXkQF6HlbU1/SUMmk6n5ABBGaSZqCK0oIXaMln8YR nKDA== X-Gm-Message-State: AOAM530bzVX1wtP/if7qyCDSuc/040aI6LXF4TYZ3eSqCjG/AIbTXrXo OGQlZXGL7NzqHqqGcWnhBsYIQVApXOLS8IL+ X-Google-Smtp-Source: ABdhPJz8XBFTbs9ZD7oR7K7l8ldKW18fc9alkUlMB6/h7G6PfLqyPEyBGIkPQX1dnc5wCHIRuSagLg== X-Received: by 2002:a6b:dc0f:: with SMTP id s15mr5671711ioc.180.1601738771342; Sat, 03 Oct 2020 08:26:11 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id l77sm2099558ill.4.2020.10.03.08.26.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Oct 2020 08:26:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Bin Meng , Daniel Schwierzeck , Heiko Schocher , Heinrich Schuchardt , Marek Vasut , Michal Simek , Stephen Warren Subject: [PATCH 17/17] Azure/GitLab/Travis: Add SPL unit tests Date: Sat, 3 Oct 2020 09:25:34 -0600 Message-Id: <20201003152534.3184504-18-sjg@chromium.org> X-Mailer: git-send-email 2.28.0.806.g8561365e88-goog In-Reply-To: <20201003152534.3184504-1-sjg@chromium.org> References: <20201003152534.3184504-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.3 at phobos.denx.de X-Virus-Status: Clean Run SPL unit tests in all test environments. Signed-off-by: Simon Glass --- .azure-pipelines.yml | 2 +- .gitlab-ci.yml | 2 +- .travis.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 473ddee3835..a78c8d61300 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -182,7 +182,7 @@ jobs: OVERRIDE: "-O clang-10" sandbox_spl: TEST_PY_BD: "sandbox_spl" - TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff" + TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl" sandbox_flattree: TEST_PY_BD: "sandbox_flattree" evb_ast2500: diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9ac2b336a11..b1e0b3bc9dd 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -198,7 +198,7 @@ sandbox_spl test.py: tags: [ 'all' ] variables: TEST_PY_BD: "sandbox_spl" - TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff" + TEST_PY_TEST_SPEC: "test_ofplatdata or test_handoff or test_spl" <<: *buildman_and_testpy_dfn evb-ast2500 test.py: diff --git a/.travis.yml b/.travis.yml index fb8f73157d7..cb48ff3023a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -512,7 +512,7 @@ matrix: - name: "test/py sandbox_spl" env: - TEST_PY_BD="sandbox_spl" - TEST_PY_TEST_SPEC="test_ofplatdata or test_handoff" + TEST_PY_TEST_SPEC="test_ofplatdata or test_handoff or test_spl" TOOLCHAIN="i386" TEST_PY_TOOLS="yes" - name: "test/py sandbox_flattree"