From patchwork Mon Jul 5 22:32:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500963 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=lyKqMrKV; 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 4GJgSv240Fz9sWX for ; Tue, 6 Jul 2021 08:33:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E98BA82BE0; Tue, 6 Jul 2021 00:33: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="lyKqMrKV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id AD7EB82BF3; Tue, 6 Jul 2021 00:33:17 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x232.google.com (mail-oi1-x232.google.com [IPv6:2607:f8b0:4864:20::232]) (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 B5FC782BE0 for ; Tue, 6 Jul 2021 00:33: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-oi1-x232.google.com with SMTP id t3so22342193oic.5 for ; Mon, 05 Jul 2021 15:33: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=ed+aEKWQkp15NKlQ+I/xCkOeOFSZLCKghTbAr6e7ugU=; b=lyKqMrKVc8Hiq+zuVsRsgVmNkNLWReTsPrMdb7k9Mhda+wIY+H1IS57IVm40hMtPjp 3MmIdnLUod9dxf+9zWK12RdO8h2oYlkXkdqur5uZeOXWSS2yVvvmSrfYkjb6JPpVq5QJ uzUiKgUYcr2IKd/GGXGoc1IhUt/Df5+M/RsiY= 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=ed+aEKWQkp15NKlQ+I/xCkOeOFSZLCKghTbAr6e7ugU=; b=qE5XqR/QL0QEVRxLrUJzpKjDx0pA8b5abR/MgVgxL+5BYXY5kzTPcPgl9W49T34+Et ZhF4O1VQMLojDQNxK7OWcB4T93YfNUoAbspFsOoCwMe+rvNBaFvp2qOPkP+PI7ORc5bm Nj8JMwOHCIS7wHuDS1jkGzQS1FRZE3ChmwTiwefCNIzzKRRqNIvKD3AXljxpU8c4zoY3 DLmrC53IYNfdtIs7h7IU/Y4mePi9rRJptQm/g/y81X+X7bXVLBBhxX4oq970uw0KvYWd fAVyqBOINHY/hwOJaVuE+uXI/VxXM9mFPdj4MfQR2dN7sUwj0G2B1WdESrht0NHmFnsa zoCg== X-Gm-Message-State: AOAM531SZnOYpAoJNhLTi6MQexBpeepp1mdyX/kuHtrw5CizrGtwmJSa 9rTN6N6HH8GtMJoWyFnqx6JTs8y0XOb1AzuF X-Google-Smtp-Source: ABdhPJxAKnBLgLTxjJWB/Nkp4T5mqqCbHYQalBnCBYAasx03IdJwhnldEsSrpEw6dJtB+JTVNxrTSA== X-Received: by 2002:aca:4ad2:: with SMTP id x201mr9764105oia.167.1625524391166; Mon, 05 Jul 2021 15:33:11 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 01/22] dm: core: Add logging for DM_SEQ_ALIAS Date: Mon, 5 Jul 2021 16:32:39 -0600 Message-Id: <20210705223300.2139971-2-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean It is sometimes helpful to see which sequence is assigned to a device. Add debugging info for that. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/core/device.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/core/device.c b/drivers/core/device.c index 9f1400768de..29668f6fb30 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -87,8 +87,10 @@ static int device_bind_common(struct udevice *parent, const struct driver *drv, if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { if (uc->uc_drv->name && ofnode_valid(node)) { - if (!dev_read_alias_seq(dev, &dev->seq_)) + if (!dev_read_alias_seq(dev, &dev->seq_)) { auto_seq = false; + log_debug(" - seq=%d\n", dev->seq_); + } } } } From patchwork Mon Jul 5 22:32:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500967 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NF0e5sN8; 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 4GJgTd3MCvz9sWX for ; Tue, 6 Jul 2021 08:34:13 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AD46782C1F; Tue, 6 Jul 2021 00:33:40 +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="NF0e5sN8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B3FC682C06; Tue, 6 Jul 2021 00:33:21 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 D0A8782BF4 for ; Tue, 6 Jul 2021 00:33:13 +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-oi1-x236.google.com with SMTP id l21so1391332oig.3 for ; Mon, 05 Jul 2021 15:33:13 -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=3PMNvfE8WvJad1TFPjPOxAlm0bWdCsn9fWIDZFDmT5k=; b=NF0e5sN8fHO0I12Nw31evYQpXHShLjcAhvt2QxUvwuwurVSFkFsmLWYHou6vPaj0T8 xceacHDIizYqQfyUF56Ner5Stt+Ubial7dmlM5yiCgj1sB1egRvJbZ1TRouK4y2ALSeV SCcq4DuanO1RSItK24uxp3RasNn0JgDRemsy8= 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=3PMNvfE8WvJad1TFPjPOxAlm0bWdCsn9fWIDZFDmT5k=; b=VqeQJBwzZ9QsVMPF2e/ZNEvhqGoRSlTqFylfJeB47flBFGPNtiwA90Y0pUd3Y84sXd JhaiHhlkTxVK8H5xcDBwMgdGdwvNVXNlndk/yA1HMvU26mF2kyb08aeliExTg5E4pH8S 1QvRE+BfWMoIpdsN697iVuvKtqzpby+gZ8u5x9wv5OIokREW29GY8qzAzJ6xElnTnv2S k+y7lb0xV6kz9KQiq6D3YBoNTbzXlM336BZSgv6kz/2OiLrnRQ6Mmib8ugDRmsDNlQPZ SN51SJCzcIJRIIimGImITMQFrexSY3MvFHOn1/1DZBsrHeyPpogOZ/hsb+7eZPKHT9mo 99UQ== X-Gm-Message-State: AOAM531oGm8XxcoSFwyR8k6JpG87Lw4T/iuQMjn5Jh0x3iE44d1E6oqR ufYBwGggNHCpSWgApnFK48VmSv8weh43Qn2U X-Google-Smtp-Source: ABdhPJwbnp6JC8S11sERl5NddxvhI6qMTjBDCcWFFe0Dc6ijwOHVKhKp11+7lD3S7ZfU5kEIX0zdug== X-Received: by 2002:a05:6808:3ba:: with SMTP id n26mr11897098oie.151.1625524392038; Mon, 05 Jul 2021 15:33:12 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:11 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Marek Vasut , Pavel Herrmann Subject: [PATCH 02/22] dm: Support lzma in the flashmap Date: Mon, 5 Jul 2021 16:32:40 -0600 Message-Id: <20210705223300.2139971-3-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Allow lzma compression as well as lz4. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/core/of_extra.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/core/of_extra.c b/drivers/core/of_extra.c index 7702beff97b..632a1c2210e 100644 --- a/drivers/core/of_extra.c +++ b/drivers/core/of_extra.c @@ -31,6 +31,8 @@ int ofnode_read_fmap_entry(ofnode node, struct fmap_entry *entry) if (prop) { if (!strcmp(prop, "lz4")) entry->compress_algo = FMAP_COMPRESS_LZ4; + else if (!strcmp(prop, "lzma")) + entry->compress_algo = FMAP_COMPRESS_LZMA; else return log_msg_ret("compression algo", -EINVAL); } else { From patchwork Mon Jul 5 22:32:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500965 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=lpGvboRz; 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 4GJgTF63syz9sWX for ; Tue, 6 Jul 2021 08:33:53 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9753782C10; Tue, 6 Jul 2021 00:33:29 +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="lpGvboRz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CCC5782BFE; Tue, 6 Jul 2021 00:33:20 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (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 5235782BF5 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x22a.google.com with SMTP id l21so1391370oig.3 for ; Mon, 05 Jul 2021 15:33:14 -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=MizIDwVA1+LkpB5Eh//P7cjyFfhmNi0NrsMRtTEMxaU=; b=lpGvboRzuflz15fOK541/XfCduAP6fPhHgBn5ugLX4z5F60sR63nCjJu6gVwcjixUR 7ENIvYcyOnBEicPIG9xTjXVS5wuxX+BR74S4AKKISkhyxQSwJmCsLOfBj5FsYSKUhmtE BzEoe4DnR1NlBrTKz/TsolKi9YR29hYlusYSs= 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=MizIDwVA1+LkpB5Eh//P7cjyFfhmNi0NrsMRtTEMxaU=; b=AfRXf7za1eUw2B44PzEfp6gHkB31XQevycR9iHcuXQaX35RFoi6udAtjgYk0fkeZGk LGsorTIZE9lq5euXcMmVPZ2/CCs0YfZ6WNGFLICXD9LIQ/wVocJ+4yZYFZL1Uh/pCGjW kTlNopgqNTTGJp5i5WZzgj5vAZxLd8gI8eSUeJxWPJoxsUd6l2X10SXFcaxsYIV/kOg+ JK62RML//Pc8Tssmq8E7YPWXorLh1/DrxIhuQOxT1Hczi5fo3/Z+mPkKioCPr95b4x0d ooJFGwklJ9TA/CMuO+b3kkmY5KLMoHMrUrNttsRQlhAau3AuD3g7Pd89yRLIwN766dxg iPtg== X-Gm-Message-State: AOAM531Qf7iptbz2z4SbR4iPClvLzJjqY+aWTV3ZBpK8BY4TJjkYyoNd k6iLXFw6dixZLoR2CsLsp1g2vKyhue1cF1CR X-Google-Smtp-Source: ABdhPJyUMFVn0ePXq8iRPNK0m3C7cTVa0O5WLWuJzxkMeIw3/rGrh/IlKIkjtBbiHfoJhtjmS5l8oA== X-Received: by 2002:aca:2112:: with SMTP id 18mr449227oiz.48.1625524392864; Mon, 05 Jul 2021 15:33:12 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:12 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt Subject: [PATCH 03/22] test: Allow CONFIG_SPL_LOAD_FIT to be disabled Date: Mon, 5 Jul 2021 16:32:41 -0600 Message-Id: <20210705163234.3.If7155778a9f452a58286479aa704bab538feb6bb@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean At present if this is not enabled on a sandbox build, the build fails. Add a condition to avoid this. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/Makefile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/Makefile b/test/Makefile index a26e915e050..117839e5847 100644 --- a/test/Makefile +++ b/test/Makefile @@ -3,7 +3,9 @@ # (C) Copyright 2012 The Chromium Authors obj-y += test-main.o +ifdef CONFIG_SPL_LOAD_FIT obj-$(CONFIG_SANDBOX) += image/ +endif ifneq ($(CONFIG_$(SPL_)BLOBLIST),) obj-$(CONFIG_$(SPL_)CMDLINE) += bloblist.o From patchwork Mon Jul 5 22:32:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500964 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=PKG2pEvE; 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 4GJgT10qj8z9sWX for ; Tue, 6 Jul 2021 08:33:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 890EE82C02; Tue, 6 Jul 2021 00:33: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="PKG2pEvE"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7C32082C02; Tue, 6 Jul 2021 00:33:21 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) (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 632AC829C0 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x235.google.com with SMTP id h9so22353648oih.4 for ; Mon, 05 Jul 2021 15:33:15 -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=kTZQf9uCOA16IjKuc+yNWZOs06yPegq26vPyhnluoYs=; b=PKG2pEvEktTH5RHQ2f+k+T2syocgffDPZYZJGL6VtiOEqDBNjXhX4ZXDee6m2goHfg 3hU+VE7NGzcObBIyCarwAiBQGT8vCXSl8NLuVIv2P96Af5/RDWOXdhEVVz6snDrwdrLP aGKlY3IFUmiAqfl506/0QKmlLOBG59du+J0Yo= 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=kTZQf9uCOA16IjKuc+yNWZOs06yPegq26vPyhnluoYs=; b=ZCE0dR62KaIB/xrg1TgfCJnHGSJ/86h/FZk32Te5X3jxxh4WMKfYzchnmI8VQDxDcA 2Io8LH6DCYjR18g11rARCVhPf6SvoJwVDu6NQyFO9EvJH11xNltXw1i6zwpiawcJGtZ9 8EOKlVxFzEhp1Z6KUUzjcbCAKixIZJ12KvsaVE3tAqT9Xkd87s1YXCbsfyy3xcX5vrMa iCFoIX0eDrx2vR0pPclweystUVhsiEfogLl656OSg6sUi8qQBncP+BYvcsBdvXOzD/9m 4BJl7Q0Yzw1ufP2m1G4WoWWVnWTFWsAzBK1giUFXDz2JOH0wYja2iSstPdtme3vlIYzV NPZg== X-Gm-Message-State: AOAM533bqkq1/CqFDKUz2ec+71zn3kYcxfWFQ3VP1Lhzlxds6UwMa27H kR+8GMMpWCW9FXlJcdWpqALu8I4zpM+SCeQ1 X-Google-Smtp-Source: ABdhPJws2APh/mHhI94pHhZhQiJUFrniU8DaYgSpO43UkuHZhlemdmN5YVUVRFPT1u85kc4xLiB1wg== X-Received: by 2002:a05:6808:8f7:: with SMTP id d23mr1049497oic.14.1625524393660; Mon, 05 Jul 2021 15:33:13 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:13 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 04/22] test: Add DM_DMA to be disabled Date: Mon, 5 Jul 2021 16:32:42 -0600 Message-Id: <20210705163234.4.I8a9a163a9ced28ceadd51a69b55ca2777d275aa6@changeid> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean At present if DM_DMA is disabled on a sandbox build, the build fails. Make the test conditional. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/dm/core.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/dm/core.c b/test/dm/core.c index 2210345dd14..0492698997c 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -1171,6 +1171,7 @@ static int dm_test_all_have_seq(struct unit_test_state *uts) } DM_TEST(dm_test_all_have_seq, UT_TESTF_SCAN_PDATA); +#if CONFIG_IS_ENABLED(DM_DMA) static int dm_test_dma_offset(struct unit_test_state *uts) { struct udevice *dev; @@ -1200,3 +1201,4 @@ static int dm_test_dma_offset(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_dma_offset, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); +#endif From patchwork Mon Jul 5 22:32:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500968 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=JwhGfItJ; 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 4GJgTr2FwSz9sWX for ; Tue, 6 Jul 2021 08:34:24 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 702BC82C19; Tue, 6 Jul 2021 00:33:45 +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="JwhGfItJ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B79CE82BFD; Tue, 6 Jul 2021 00:33:22 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 F228882A29 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x236.google.com with SMTP id m3so3400579oig.10 for ; Mon, 05 Jul 2021 15:33:15 -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=cBAs8TZ4f2MCGg0RODnxRlrTCl6h7qIpDKADzGC2YJ4=; b=JwhGfItJTHeR/q6c3UfP8C/ZA06SUC1vjjVC8NnYLNv7dyG+XKyPH07qsgVgQ6sOjq 9ri8oY8b6jHNBzqR6tkVuVVDp19j8mKN94wfOAN4brpLy1tsqtEP2xu53KL2QgIGz18+ NPdY4jzIz+EC47BnlA3qintgB0iPyEWDZfAAU= 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=cBAs8TZ4f2MCGg0RODnxRlrTCl6h7qIpDKADzGC2YJ4=; b=GJejrR/czBUaMJc+WOJvkzlEWmDmaz1UxKHrNqggEJQs3SnZyBxoPgJnaSw5+4Rps3 QlVtjOQD70svC8t4tL2PIuu9aEn/3M94aruWz5OqFLPrQUcrWyoUdabAmhBf2DbXUiG3 OhaJeDdf0DA2r9bL2Xc3ZqOtM8yyL/+Kj3a8rdOjwruicVKr78n4zRWX52ABWb8aK0V8 sCiLxSuyDvc4/md2trMC6P5X7G/SRNowKKKeV90Ve1v1tYvzqUDe5Uwyk8xkMUVr+KvG geT3317DsqrDne+n87mbZwh7rqgApuIjWVwOmH8d0aq3yy9PihwCtMaOC9gwdE54tnvR WV3g== X-Gm-Message-State: AOAM532+Or5ZAueK/MXAhykkY+JTCpRi5sI2phtXMrn1nDIRLKz75Igw jY80MxX3dynfirmx69AEZriZKAn2PMgqqLUB X-Google-Smtp-Source: ABdhPJxs4CEJTazUHHsnr4kXcD3GEWugFXSy7sSaYiLGpykjZaQQwjLR4MiOxCwbThcnGmto0V8J2A== X-Received: by 2002:aca:b18a:: with SMTP id a132mr1037084oif.30.1625524394454; Mon, 05 Jul 2021 15:33:14 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:14 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Andy Shevchenko Subject: [PATCH 05/22] test: Avoid a build error with SPL Date: Mon, 5 Jul 2021 16:32:43 -0600 Message-Id: <20210705223300.2139971-4-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean At present this fails to build chromeos_sandbox due to a rebase error in dm_test_pre_run(). Fix it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- test/test-main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test-main.c b/test/test-main.c index 7afe8741cf9..3cdf6849c57 100644 --- a/test/test-main.c +++ b/test/test-main.c @@ -45,7 +45,7 @@ static int dm_test_pre_run(struct unit_test_state *uts) uts->force_fail_alloc = false; uts->skip_post_probe = false; gd->dm_root = NULL; - if (IS_ENABLED(CONFIG_UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA)) + if (CONFIG_IS_ENABLED(UT_DM) && !CONFIG_IS_ENABLED(OF_PLATDATA)) memset(dm_testdrv_op_count, '\0', sizeof(dm_testdrv_op_count)); arch_reset_for_test(); From patchwork Mon Jul 5 22:32:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500966 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=bS6qXZHz; 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 4GJgTQ4HcGz9sWX for ; Tue, 6 Jul 2021 08:34:02 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id AAD5682C1A; Tue, 6 Jul 2021 00:33:36 +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="bS6qXZHz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 97EDB82C04; Tue, 6 Jul 2021 00:33:22 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 D369B82BE3 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x231.google.com with SMTP id w74so461635oiw.8 for ; Mon, 05 Jul 2021 15:33:16 -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=nLssdIkDJdkjurDqPW6Qrw0/V81a5JUGr2GIGjJ+QuI=; b=bS6qXZHzQVCoVzY4vkr5Y0HdGgXiJz0DmWa9GrvXqMjEFCvvjSEnKI+SucRbdYCW3X MrnTsAwqQa2DYsXKbs10ee8XqDudGwnY4nn0GwOTvItsToEnIQRUoVX/RlNM06zNRUaA JpF9qxIW/bn+z1zWEbG0Ap9vx9Bj5pIWuBfLo= 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=nLssdIkDJdkjurDqPW6Qrw0/V81a5JUGr2GIGjJ+QuI=; b=HoQAb8hfKP9XHC3tT7SL3q9gZKsGSQLhmVFtbH35yIn0QBWiq5DftYb3IzxlDt8+2S JeEv8yl71rmpoO9gtVfJIWQ+UX7yW3sohUxsRAv6aZxECuUFkEs+zaPKfeIy73VF+Wbb 1gII6qhV3e2sjhNY5zV1tFUcqpAQ0riBBQkl1ug6xVX1ewfF5kBhDoedt3Y9LIGCYlGf UuANb+/yp+2yZVq8lRd6HcQKYmiwnbgby7dokxttn9geH0EhGmRswq8EpvIFBB/YGYbB U/AuYnYGvSanUisv/rSrvXYfJlkbk/h2IDDpSSTCgb6KL0jnsWOyynltJ65fziGEuPxX Q9GQ== X-Gm-Message-State: AOAM532+8SpklZUH55feQ8mBDrl/CKsGLRiwxFjjTE9ZpnYxlKlepvgk +wVLCkgp/e65eqh8D1XOZunUVoJ1NoKioSUz X-Google-Smtp-Source: ABdhPJyEGiLu0FSsiO4kuZbONE9rpwE+e6DBeM7/cfw7ELX3nbfJ7FIvTUg9aH9O3fM7I8xrBGScww== X-Received: by 2002:a05:6808:64e:: with SMTP id z14mr11715865oih.129.1625524395404; Mon, 05 Jul 2021 15:33:15 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:15 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Masahiro Yamada , Michal Simek , Roger Pau Monne Subject: [PATCH 06/22] Makefile: Avoid rebuilding .dtb files each time Date: Mon, 5 Jul 2021 16:32:44 -0600 Message-Id: <20210705223300.2139971-5-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Drop the FORCE from the rule that builds .dtb files and let the normal dependency checking do its work. This should work correctly, at least for .dts files that don't use /include/. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- scripts/Makefile.lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 78bbebe7e93..03b348c8df8 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -328,7 +328,7 @@ cmd_dtc = mkdir -p $(dir ${dtc-tmp}) ; \ ; \ sed "s:$(pre-tmp):$(<):" $(depfile).pre.tmp $(depfile).dtc.tmp > $(depfile) -$(obj)/%.dtb: $(src)/%.dts FORCE +$(obj)/%.dtb: $(src)/%.dts $(call if_changed_dep,dtc) pre-tmp = $(subst $(comma),_,$(dot-target).pre.tmp) From patchwork Mon Jul 5 22:32:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500970 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=MKS+bYvV; 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 4GJgVH5nNvz9sWX for ; Tue, 6 Jul 2021 08:34:47 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2CD9082BFF; Tue, 6 Jul 2021 00:33:52 +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="MKS+bYvV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 4D43182BE4; Tue, 6 Jul 2021 00:33:28 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE, T_FILL_THIS_FORM_SHORT autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (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 4BAD682BE4 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-ot1-x335.google.com with SMTP id d21-20020a9d72d50000b02904604cda7e66so19695062otk.7 for ; Mon, 05 Jul 2021 15:33:18 -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=GAHz2EUcGCEvvjI87sajnwwAcVITfg/MdtE80QOQZ38=; b=MKS+bYvVJp47V89NZUNPBouFP6BFf6wAghmh4qodxOXJRFNzyZjZuw0m43rwgT+ZNR BJe6C5ZIzRfYYn/6jNUfKE3glQXjMSs7BXES+CC6CzCvWNrmNwuN+k86EMEiet6dsWpl 0PG5i88GDYDsP1UfiPWF0l1Ft8mN9IWDrRbTc= 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=GAHz2EUcGCEvvjI87sajnwwAcVITfg/MdtE80QOQZ38=; b=Hx20n8ob+x0eSGNaLnQaaqmj2pGJpIy4UWx37xWXJsBmjR4UWlo9rWCkUU3A8wEMEN NE/hMXj0h5/0O8TcQK5nUANo2k+oQaoZ0JdpgYabDSC1eoH9N5GsC4ViyV9TdsbptPEE dXEQkHr8QwCZ18JZvf7ywoUKN2Vl3RfEhIar3pmYIxlRx3JEaLFtN/EB4JFryz7ZlBqB I/3nDhyS92hIlaksp8SIAeREQRFVlJyoHuoJIjxmCZOM9gphTj9pZa52gtstgj9qW/jB 8g0VmkHaxFC+8SdNW1Qw74nepw9kqreuDOgwVGfWTY4Sb8wEJjk2wgNLbjMR5n/vkEwe +ocw== X-Gm-Message-State: AOAM531qhxHcFqGN84I4UESoYOs5ezg7y2IMPAAzF/bVQE2Rl2vddfj+ U5zcFg76da0lx4oGsrcV0pAihovER3fdp6Gh X-Google-Smtp-Source: ABdhPJyicDdCeS9BBwiJ7SPQEkHh0ZEP6YX9z/6lOgg26/DnsBn1jSH0E60XaYDXMgORHboMSikttw== X-Received: by 2002:a9d:5603:: with SMTP id e3mr6396176oti.178.1625524396442; Mon, 05 Jul 2021 15:33:16 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:16 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alexandru Gagniuc , Dario Binacchi , Faiz Abbas , Heinrich Schuchardt , =?utf-8?q?Marek_Beh=C3=BAn?= , Michael Walle , Patrick Delaunay , Peng Fan Subject: [PATCH 07/22] sandbox: Support executables for more phases Date: Mon, 5 Jul 2021 16:32:45 -0600 Message-Id: <20210705223300.2139971-6-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean The SPL header has a function for obtaining the phase in capital letters, e.g. 'SPL'. Add one for lower-case also, as used by sandbox. Use this to generalise the sandbox logic for determining the filename of the next sandbox executable. This can provide support for VPL. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/cpu/os.c | 63 +++++++++++++++------------------- arch/sandbox/cpu/spl.c | 18 ++++++++-- arch/sandbox/include/asm/spl.h | 13 +++++++ include/os.h | 5 ++- include/spl.h | 23 +++++++++++++ test/image/spl_load.c | 6 +++- 6 files changed, 89 insertions(+), 39 deletions(-) diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 0d21827e1b7..a8aa9def27f 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -783,12 +783,14 @@ int os_jump_to_image(const void *dest, int size) return os_jump_to_file(fname, true); } -int os_find_u_boot(char *fname, int maxlen, bool use_img) +int os_find_u_boot(char *fname, int maxlen, bool use_img, + const char *cur_prefix, const char *next_prefix) { struct sandbox_state *state = state_get_current(); const char *progname = state->argv[0]; int len = strlen(progname); - const char *suffix; + char subdir[10]; + char *suffix; char *p; int fd; @@ -798,45 +800,36 @@ int os_find_u_boot(char *fname, int maxlen, bool use_img) strcpy(fname, progname); suffix = fname + len - 4; - /* If we are TPL, boot to SPL */ - if (!strcmp(suffix, "-tpl")) { - fname[len - 3] = 's'; - fd = os_open(fname, O_RDONLY); - if (fd >= 0) { - close(fd); - return 0; - } - - /* Look for 'u-boot-spl' in the spl/ directory */ - p = strstr(fname, "/spl/"); - if (p) { - p[1] = 's'; - fd = os_open(fname, O_RDONLY); - if (fd >= 0) { - close(fd); - return 0; - } - } - return -ENOENT; - } + /* Change the existing suffix to the new one */ + if (*suffix != '-') + return -EINVAL; - /* Look for 'u-boot' in the same directory as 'u-boot-spl' */ - if (!strcmp(suffix, "-spl")) { - fname[len - 4] = '\0'; - fd = os_open(fname, O_RDONLY); - if (fd >= 0) { - close(fd); - return 0; - } + if (*next_prefix) + strcpy(suffix + 1, next_prefix); /* e.g. "-tpl" to "-spl" */ + else + *suffix = '\0'; /* e.g. "-spl" to "" */ + fd = os_open(fname, O_RDONLY); + if (fd >= 0) { + close(fd); + return 0; } - /* Look for 'u-boot' in the parent directory of spl/ */ - p = strstr(fname, "spl/"); + /* + * We didn't find it, so try looking for 'u-boot-xxx' in the xxx/ + * directory. Replace the old dirname with the new one. + */ + snprintf(subdir, sizeof(subdir), "/%s/", cur_prefix); + p = strstr(fname, subdir); if (p) { - /* Remove the "spl" characters */ - memmove(p, p + 4, strlen(p + 4) + 1); + if (*next_prefix) + /* e.g. ".../tpl/u-boot-spl" to "../spl/u-boot-spl" */ + memcpy(p + 1, next_prefix, strlen(next_prefix)); + else + /* e.g. ".../spl/u-boot" to ".../u-boot" */ + strcpy(p, p + 1 + strlen(cur_prefix)); if (use_img) strcat(p, ".img"); + fd = os_open(fname, O_RDONLY); if (fd >= 0) { close(fd); diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c index f82b0d3de16..be86182fd85 100644 --- a/arch/sandbox/cpu/spl.c +++ b/arch/sandbox/cpu/spl.c @@ -17,7 +17,21 @@ DECLARE_GLOBAL_DATA_PTR; -/* SPL / TPL init function */ +int sandbox_find_next_phase(char *fname, int maxlen, bool use_img) +{ + const char *cur_prefix, *next_prefix; + int ret; + + cur_prefix = spl_phase_prefix(spl_phase()); + next_prefix = spl_phase_prefix(spl_next_phase()); + ret = os_find_u_boot(fname, maxlen, use_img, cur_prefix, next_prefix); + if (ret) + return log_msg_ret("find", ret); + + return 0; +} + +/* SPL / TPL / VPL init function */ void board_init_f(ulong flag) { struct sandbox_state *state = state_get_current(); @@ -37,7 +51,7 @@ static int spl_board_load_image(struct spl_image_info *spl_image, char fname[256]; int ret; - ret = os_find_u_boot(fname, sizeof(fname), false); + ret = sandbox_find_next_phase(fname, sizeof(fname), false); if (ret) { printf("(%s not found, error %d)\n", fname, ret); return ret; diff --git a/arch/sandbox/include/asm/spl.h b/arch/sandbox/include/asm/spl.h index 51e9d95d557..d25dc7c82a0 100644 --- a/arch/sandbox/include/asm/spl.h +++ b/arch/sandbox/include/asm/spl.h @@ -12,4 +12,17 @@ enum { BOOT_DEVICE_BOARD, }; +/** + * sandbox_find_next_phase() - Find the next phase of U-Boot + * + * This function is intended to be called from within sandbox SPL. It uses + * a few rules to find the filename of the next U-Boot phase. See also + * os_find_u_boot(). + * + * @fname: place to put full path to U-Boot + * @maxlen: maximum size of @fname + * @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file + */ +int sandbox_find_next_phase(char *fname, int maxlen, bool use_img); + #endif diff --git a/include/os.h b/include/os.h index bd1096eb8b3..7b20d606dd0 100644 --- a/include/os.h +++ b/include/os.h @@ -327,9 +327,12 @@ int os_jump_to_image(const void *dest, int size); * @fname: place to put full path to U-Boot * @maxlen: maximum size of @fname * @use_img: select the 'u-boot.img' file instead of the 'u-boot' ELF file + * @cur_prefix: prefix of current executable, e.g. "spl" or "tpl" + * @next_prefix: prefix of executable to find, e.g. "spl" or "" * Return: 0 if OK, -NOSPC if the filename is too large, -ENOENT if not found */ -int os_find_u_boot(char *fname, int maxlen, bool use_img); +int os_find_u_boot(char *fname, int maxlen, bool use_img, + const char *cur_prefix, const char *next_prefix); /** * os_spl_to_uboot() - Run U-Boot proper diff --git a/include/spl.h b/include/spl.h index d9fe4e1bfd4..cf77d379da2 100644 --- a/include/spl.h +++ b/include/spl.h @@ -188,6 +188,29 @@ static inline const char *spl_phase_name(enum u_boot_phase phase) } } +/** + * spl_phase_prefix() - Get the prefix of the current phase + * + * @phase: Phase to look up + * @return phase prefix ("spl", "tpl", etc.) + */ +static inline const char *spl_phase_prefix(enum u_boot_phase phase) +{ + switch (phase) { + case PHASE_TPL: + return "tpl"; + case PHASE_VPL: + return "vpl"; + case PHASE_SPL: + return "spl"; + case PHASE_BOARD_F: + case PHASE_BOARD_R: + return ""; + default: + return "phase?"; + } +} + /* A string name for SPL or TPL */ #ifdef CONFIG_SPL_BUILD # ifdef CONFIG_TPL_BUILD diff --git a/test/image/spl_load.c b/test/image/spl_load.c index 851603ddd75..e7cabf5680c 100644 --- a/test/image/spl_load.c +++ b/test/image/spl_load.c @@ -56,6 +56,7 @@ struct image_header *spl_get_load_buffer(ssize_t offset, size_t size) static int spl_test_load(struct unit_test_state *uts) { + const char *cur_prefix, *next_prefix; struct spl_image_info image; struct image_header *header; struct text_ctx text_ctx; @@ -68,7 +69,10 @@ static int spl_test_load(struct unit_test_state *uts) load.bl_len = 512; load.read = read_fit_image; - ret = os_find_u_boot(fname, sizeof(fname), true); + cur_prefix = spl_phase_prefix(spl_phase()); + next_prefix = spl_phase_prefix(spl_next_phase()); + ret = os_find_u_boot(fname, sizeof(fname), true, cur_prefix, + next_prefix); if (ret) { printf("(%s not found, error %d)\n", fname, ret); return ret; From patchwork Mon Jul 5 22:32:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500969 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Jcqe+5Lj; 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 4GJgV40yStz9sWX for ; Tue, 6 Jul 2021 08:34:36 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9268882C29; Tue, 6 Jul 2021 00:33:48 +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="Jcqe+5Lj"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B57982C0A; Tue, 6 Jul 2021 00:33:25 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) (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 DC74682BD7 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x22c.google.com with SMTP id r29so5923592oiw.13 for ; Mon, 05 Jul 2021 15:33:18 -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=BiM6mf/4P3U/qewq57IZHVHCh+KLf22R49Fn4q10YUQ=; b=Jcqe+5Ljg9y4WWjf51hnzkQGkJKILQGOfHzofqPmgI1ecTX93ggk3YvDyY1olithZY 3CfMJElPwyKIC0ebvJBBFkY6LdFZs3Y3iSmcSbF+DDoCM5pHAFQaN+iIvGV8ZPE38B6N a9yYT6sq34KK+T7B4iP7HbSuftXtVLjdzyH/8= 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=BiM6mf/4P3U/qewq57IZHVHCh+KLf22R49Fn4q10YUQ=; b=FsEXjss2+HncuLlPBPJvfAunjVZ+jYfMUB8roT3SjCkZMZDDVFIieMUapmXtZNUYDr nSVSe7OE1zhhxzxp1cilAEQzrRH6UfrwOXwEj27QVVvoUHROeOjv0ETkUOD9NdUfZJwD JL2nVtKq8GOfnRWIgwGr/TA4f4Nk0K3PBM+WYGNpdRdah1qqv098uY9pxSFshta7cp72 6nV2jGng+quqKortVCbqn3EIAhYLLpLos0Ayz+jkyx/euzVQAf8WfnQPymx38vv6jbcj vGpd4ny4oo+cJrJSwVfi/TLn/A9QIOThGhekAZz/PPgzoJrJA2745HDkTApEvxnHVRzH 87yw== X-Gm-Message-State: AOAM530lvaAA6o8M/cr2aBIuh5tPeTEGIDG/atKNtqUsW9JGGdy4JmsJ XUHFdCcPWo/3EAZTKMeT4gwQ5Q0yN/gVFbwy X-Google-Smtp-Source: ABdhPJzI14pGn2nKFWFTMMTOttHFdjel9uzTvtFGoirimn9WX7nlubGuMLIhp5iuYz7ycyJBr+0l2g== X-Received: by 2002:a05:6808:158d:: with SMTP id t13mr11496279oiw.134.1625524397367; Mon, 05 Jul 2021 15:33:17 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:16 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Harald Seiler , Heinrich Schuchardt Subject: [PATCH 08/22] sandbox: Add work-around for SDL2 display Date: Mon, 5 Jul 2021 16:32:46 -0600 Message-Id: <20210705223300.2139971-7-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean At present the display does not show on some machines, e.g. Ubunutu 20.04 but the reason is unknown. Add a work-around until this can be determined. Also include more error checking just in case. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/cpu/sdl.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index 8102649be3a..e2649494818 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -164,8 +164,29 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp, int sandbox_sdl_sync(void *lcd_base) { + struct SDL_Rect rect; + int ret; + + if (!sdl.texture) + return 0; + SDL_RenderClear(sdl.renderer); SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch); - SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL); + ret = SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL); + if (ret) { + printf("SDL copy %d: %s\n", ret, SDL_GetError()); + return -EIO; + } + + /* + * On some machines this does not appear. Draw an empty rectangle which + * seems to fix that. + */ + rect.x = 0; + rect.y = 0; + rect.w = 0; + rect.h = 0; + SDL_RenderDrawRect(sdl.renderer, &rect); + SDL_RenderPresent(sdl.renderer); sandbox_sdl_poll_events(); From patchwork Mon Jul 5 22:32:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500972 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=FryPsOkx; 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 4GJgVk1Ttbz9sWq for ; Tue, 6 Jul 2021 08:35:10 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B95D182BE0; Tue, 6 Jul 2021 00:34: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=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="FryPsOkx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BDE7182C1C; Tue, 6 Jul 2021 00:33:28 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) (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 D823F82BFB for ; Tue, 6 Jul 2021 00:33:19 +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-oi1-x22e.google.com with SMTP id b2so22349344oiy.6 for ; Mon, 05 Jul 2021 15:33:19 -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=UXZ7+PoNNifTBYA0av7zZeztpFz80woDMA31dS6YmhM=; b=FryPsOkxV7+NEfMwUzyQRw8SWvNuBrzcvqoeln9+C+OH2kxyOS/lBdHUreAGwLj/Ag luyXQQsYecSHSLa5/X92DAxnV+NmGM2geCnfVm8+G3LjIhs3zoXP1zVMRYq2bzGkCOIj ToCw1mT9KYse06hNOZTwuBQWO0hudM9uIosjo= 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=UXZ7+PoNNifTBYA0av7zZeztpFz80woDMA31dS6YmhM=; b=asv/hPB87MI8Y6G2U32sCtmDcjFtCXMB3C8i958HRKy0TTrXDgZvi9EXBvEo7tICam MG8AUNYkC2ZRQu52FjsJ68nERT61kNPNYELSvrw6L3IwY47SPgA2NYqk91UNZ38YtxT6 jlJWYzQaHzDx1MXO2YSbMbVMkAnpeZOpa692BakX4eTR2wOT1q5vRM+35tOoVQrBpb4X LHn75YLZe4Dk6IMIOMDQg4ylL50PUp7X+t3oatLqrXoRr2ZtzyaOAHdUWuLwnX2vZ2My mXlkloGHA1NXcpIHWcyWnnqIXKwDz/RYhX/pdgsQ6uYvEenq6FMvfongV1WP0fDstjsR xzhA== X-Gm-Message-State: AOAM532N0tiy0UPOkKfH5QicDd8fus6uJx3wr0Rh/qVhFkw9EdozhzM7 q1CaaLcK4ClzQKI4BJ1cQyWyalJUnCMCx/Le X-Google-Smtp-Source: ABdhPJwnK+taH+qO0l4IrgNAKptPQRYw5sae7ci+DcaZ/w92Bmg49GfjFP3vWW6zWzfWy3xqv7CDJQ== X-Received: by 2002:a05:6808:f93:: with SMTP id o19mr1026785oiw.119.1625524398300; Mon, 05 Jul 2021 15:33:18 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:17 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Harald Seiler , Heinrich Schuchardt Subject: [PATCH 09/22] sandbox: Use hinting with the display Date: Mon, 5 Jul 2021 16:32:47 -0600 Message-Id: <20210705223300.2139971-8-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean SDL provides a hinting feature which provides a higher-quality image with the double-display option (-K). Enable it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- arch/sandbox/cpu/sdl.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index e2649494818..bef5abd039d 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -123,6 +123,9 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp, sdl.vis_height = sdl.height; } + if (!SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1")) + printf("Unable to init hinting: %s", SDL_GetError()); + sdl.depth = 1 << log2_bpp; sdl.pitch = sdl.width * sdl.depth / 8; SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED, From patchwork Mon Jul 5 22:32:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500974 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=TCvQ+UHC; 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 4GJgW93qmZz9sWX for ; Tue, 6 Jul 2021 08:35:33 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8980D82C4D; Tue, 6 Jul 2021 00:34: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="TCvQ+UHC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 53AD782C1B; Tue, 6 Jul 2021 00:33:33 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) (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 D322082BE2 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x230.google.com with SMTP id b2so22349394oiy.6 for ; Mon, 05 Jul 2021 15:33:20 -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=hyTQDriYiyzzeR7J55o/eKNPNdkLpTxOjLPKPogUR4Q=; b=TCvQ+UHC2vh760FzHC9QPlCX8ZdT8t/xAw761aOpOJ+8IS9jkiAjbaVNkBzWyA/Xv3 ol+pIWHN0e740Sa1dZWqVlgepNRUlf93IO7RT0S36TiIsAe2uIfSgq0C3XVoJRN4wRHY ksB8qFksdWPjErpwNHw+UVofvlDkYp4bQwZJQ= 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=hyTQDriYiyzzeR7J55o/eKNPNdkLpTxOjLPKPogUR4Q=; b=E0uRZm9Vg10T2YYHCVkQTVjdgYCjoZ7KXJ71CSIaRoUgLl3tOZeeGf/X71MAfpZL05 DDRwd2MGot4CQtBO3Eiw7Xetq/tifgZFll+Y0q2p6L1321NCnRH4IpMHWYtdD9iBVkwI Sug2GNT/t0pf400I42JfoJBwlLyOYzBHNuUAO27X+BYj51b2AWVT8nmBvCVuyr5s3Vb4 Y/N2Qv1FH+/u5QEVV+nEJjZuhDJ27ZX9H9px1/ep85RVQVpIw1IRQ6Tjp/xkiXptGLf5 KMm8qriYVZ7LBWK9uCRo2rNZIHe9b3+DlFg1UyPVX4eAlEtuthhqwL4p9QiEF6CQKVIg zkLQ== X-Gm-Message-State: AOAM5314zvAbJhEMoyq6o2KOhN4Zdg1755LNwkDX7eiQ25oxvLZtmcqI m1nZzxI+7R45BAnEjB/aqgYU0v2U7gSigMmi X-Google-Smtp-Source: ABdhPJwAYgbIaOpODOwRupQW3OeWwTDBCQBJG8Iwlw3sEJepOf8kSIAKGfYe8tK1eaWhWHBTlikE4w== X-Received: by 2002:aca:1101:: with SMTP id 1mr10019883oir.9.1625524399251; Mon, 05 Jul 2021 15:33:19 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:18 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , AKASHI Takahiro , Heinrich Schuchardt , Igor Opaniuk , Joel Peshkin , Usama Arif Subject: [PATCH 10/22] sandbox: Adjust the bloblist default address Date: Mon, 5 Jul 2021 16:32:48 -0600 Message-Id: <20210705223300.2139971-9-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Move this down to provide more space for the bloblist. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/Kconfig | 2 +- doc/arch/sandbox.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 2a7f08af1dc..21407b547da 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -791,7 +791,7 @@ config BLOBLIST_SIZE config BLOBLIST_ADDR hex "Address of bloblist" depends on BLOBLIST - default 0xe000 if SANDBOX + default 0xc000 if SANDBOX help Sets the address of the bloblist, set up by the first part of U-Boot which runs. Subsequent U-Boot stages typically use the same address. diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst index e052b6bdb09..9e23e1618c7 100644 --- a/doc/arch/sandbox.rst +++ b/doc/arch/sandbox.rst @@ -510,7 +510,7 @@ that are mapped into that memory: Addr Config Usage ======= ======================== =============================== 0 CONFIG_SYS_FDT_LOAD_ADDR Device tree - e000 CONFIG_BLOBLIST_ADDR Blob list + c000 CONFIG_BLOBLIST_ADDR Blob list 10000 CONFIG_MALLOC_F_ADDR Early memory allocation f0000 CONFIG_PRE_CON_BUF_ADDR Pre-console buffer 100000 CONFIG_TRACE_EARLY_ADDR Early trace buffer (if enabled). Also used From patchwork Mon Jul 5 22:32:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500971 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ClrCDPmO; 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 4GJgVV6Gjhz9sWq for ; Tue, 6 Jul 2021 08:34:58 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7AAB582C28; Tue, 6 Jul 2021 00:33: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=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="ClrCDPmO"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7BA2E82C0D; Tue, 6 Jul 2021 00:33:30 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) (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 B3C8C82BFF for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-oi1-x22a.google.com with SMTP id s24so7287130oiw.2 for ; Mon, 05 Jul 2021 15:33:21 -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=VpHme89Z0rCPic1Nkuyy0owdmlkiCOT5gaBDWHl46G4=; b=ClrCDPmO77zut53rL0BG55cUmyXfq0J78ghE/N3bXqvNgcKqAbY8TicaQVoi1EiC7w wfozj41CukHnytGRc23GBImFPgRfeWZ5Xz8dmAXiX84TG+Ozz+R2pZ5dVMKkK9dDwWet Qh4SJ13967S0i75xoQRx1os8IHyaHZuW3GhD4= 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=VpHme89Z0rCPic1Nkuyy0owdmlkiCOT5gaBDWHl46G4=; b=Yxe6H5uwN7yQ5LmYaJfPsn7jXALpBaXhP5eEqTptDoH8oBDqNrNsJEpY2V35iHBUNo XkRGqCzZ15WSDdUQF5QfMwy46t6QUf6C8J9V/V9hZOzgzYqBPPbdar5HAxlJrspwjGrH +IAIAhB02paG6r/L/sjzk/CPBOK8WPwgnT81SD8Lf6/LyTNIVXDD4HP32Hu9tlgEcrDf HvLwTjj7iv7y7qpLtkE3r+UGZlYeyCHiCoaaIuT4dtyVNZniHgHyTxzlHrC6RXujQN5U JCJERKsiGQ7vKgeYk0eSeVqw+Rp7f8Lprm131C+aONpkxK37dD/OCAnpu9u981ZiEtVz svyQ== X-Gm-Message-State: AOAM531pIXwA1dTkDqhuBP+V5W/rX7yuP3F1pq3ygCXkJVlYNwmxZC3F t7aqrqFWLrAhINv0igyR3ryjPQCEY+lUXuV/ X-Google-Smtp-Source: ABdhPJxCeGTTrlirmLKPElioGBW5yBoHIumnAOgnKdkssjvHLUxwf5QMoU2IH89gq2Ykkse9+5hRCA== X-Received: by 2002:aca:a8d6:: with SMTP id r205mr213092oie.77.1625524400156; Mon, 05 Jul 2021 15:33:20 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:19 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alper Nebi Yasak Subject: [PATCH 11/22] cros_ec: Allow reading the battery-charge state Date: Mon, 5 Jul 2021 16:32:49 -0600 Message-Id: <20210705223300.2139971-10-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Add a function to read this information from the EC. It is useful for determining whether the battery has enough charge to boot. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/misc/cros_ec.c | 17 +++++++++++++++++ include/cros_ec.h | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 7904d5cc72d..0818ef8ad6e 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -1661,6 +1661,23 @@ int cros_ec_get_switches(struct udevice *dev) return ret; } +int cros_ec_read_batt_charge(struct udevice *dev, uint *chargep) +{ + struct ec_params_charge_state req; + struct ec_response_charge_state resp; + int ret; + + req.cmd = CHARGE_STATE_CMD_GET_STATE; + ret = ec_command(dev, EC_CMD_CHARGE_STATE, 0, &req, sizeof(req), + &resp, sizeof(resp)); + if (ret) + return log_msg_ret("read", ret); + + *chargep = resp.get_state.batt_state_of_charge; + + return 0; +} + UCLASS_DRIVER(cros_ec) = { .id = UCLASS_CROS_EC, .name = "cros-ec", diff --git a/include/cros_ec.h b/include/cros_ec.h index 9396b4d2466..9dab6cdf9ba 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -652,4 +652,12 @@ int cros_ec_vstore_read(struct udevice *dev, int slot, uint8_t *data); int cros_ec_vstore_write(struct udevice *dev, int slot, const uint8_t *data, size_t size); +/** + * cros_ec_read_batt_charge() - Read the battery-charge state + * + * @dev: CROS-EC device + * @chargep: Return battery-charge state as a percentage + */ +int cros_ec_read_batt_charge(struct udevice *dev, uint *chargep); + #endif From patchwork Mon Jul 5 22:32:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500976 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=eXaBPvk+; 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 4GJgWX2CQhz9sWX for ; Tue, 6 Jul 2021 08:35:52 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8886082C54; Tue, 6 Jul 2021 00:34:13 +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="eXaBPvk+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 68B1382C1F; Tue, 6 Jul 2021 00:33:38 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) (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 AD77F829C0 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-ot1-x329.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so19670267otq.11 for ; Mon, 05 Jul 2021 15:33:22 -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=m4OBVyGd90a8BdPgpWTygaBZRosmSoWBg0sdhmXQTc4=; b=eXaBPvk+4FzduquncHR8QCEOlGIkH7prSUoI6PS5yC5BfLXw8WGy/clpMPqAaJM2Zv YkODY32FWvu7V4S9ZExeyCUlmVM+hE9MatmfgEFOz8hGC8RhZSDB8F4ixXq3G4dGwrvf JIugrlR7YY2a2Ku1i6o6HvLCqTHAJXjdx6bok= 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=m4OBVyGd90a8BdPgpWTygaBZRosmSoWBg0sdhmXQTc4=; b=d7U5Vq7rHMMrZ/J0WOUp4t2a/pkzKWQ+olKUfZ03bRLX4kvHOLhs0wUB5EL3LZvusk Ic9kU2ihcITFH0qpGLPiqK2XnlSMShBgGYOGcLw6YOte//Le13s0Ns4kk78Ph2RVfArb 48GsMgUusKyfvLwaqHXL/nyAZjQFWVlTn4aBs399Wql3kAtcbbwfizSAP39pGZJAxHsD tifPcltqVNgzKHmx9qpJe3FHfjtSKqo93PE//k5EC8ZinvWSszONt4I3oecTDgiyGjQu FZ6UFLo3m37ap1sXyzuCTbCva3Xd8InwKCpeqJH/dx/10wQXS5lvTdJswwXQUWRWq+J/ OHZQ== X-Gm-Message-State: AOAM5331VRvRGooA6Nb3GKVmUseibeHEECMZLag/DtkdT9pwepwC16hC wHPfr5keWgLxFe+KRjDozaeDsN2oJq/hJjPc X-Google-Smtp-Source: ABdhPJyO8a+eiH5a0KJv3QfxXK2EhEs64PqnM7NHPLlwkBkWq0+fPCIfCJjcL7+oHUDkbqlcczJV6Q== X-Received: by 2002:a9d:53ca:: with SMTP id i10mr2880033oth.60.1625524401135; Mon, 05 Jul 2021 15:33:21 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:20 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alper Nebi Yasak , Andy Shevchenko , Heinrich Schuchardt , Walter Lozano Subject: [PATCH 12/22] cros_ec: Drop cros_ec_entering_mode() Date: Mon, 5 Jul 2021 16:32:50 -0600 Message-Id: <20210705223300.2139971-11-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean This function is not needed anymore. Drop it. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/misc/cros_ec.c | 11 ----------- drivers/misc/cros_ec_sandbox.c | 3 --- include/cros_ec.h | 9 --------- 3 files changed, 23 deletions(-) diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index 0818ef8ad6e..2a15094d20a 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -754,17 +754,6 @@ int cros_ec_flash_protect(struct udevice *dev, uint32_t set_mask, return 0; } -int cros_ec_entering_mode(struct udevice *dev, int mode) -{ - int rc; - - rc = ec_command(dev, EC_CMD_ENTERING_MODE, 0, &mode, sizeof(mode), - NULL, 0); - if (rc) - return -1; - return 0; -} - static int cros_ec_check_version(struct udevice *dev) { struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index db5e3b0f51a..35e9f4eff44 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -494,9 +494,6 @@ static int process_cmd(struct ec_state *ec, case EC_CMD_MKBP_STATE: len = cros_ec_keyscan(ec, resp_data); break; - case EC_CMD_ENTERING_MODE: - len = 0; - break; case EC_CMD_GET_NEXT_EVENT: { struct ec_response_get_next_event *resp = resp_data; diff --git a/include/cros_ec.h b/include/cros_ec.h index 9dab6cdf9ba..ef89deff762 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -198,15 +198,6 @@ int cros_ec_flash_protect(struct udevice *dev, uint32_t set_mask, uint32_t set_flags, struct ec_response_flash_protect *resp); -/** - * Notify EC of current boot mode - * - * @param dev CROS-EC device - * @param vboot_mode Verified boot mode - * @return 0 if ok, <0 on error - */ -int cros_ec_entering_mode(struct udevice *dev, int mode); - /** * Run internal tests on the cros_ec interface. * From patchwork Mon Jul 5 22:32:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500975 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=VSjAL+6g; 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 4GJgWM1MBnz9sWX for ; Tue, 6 Jul 2021 08:35:43 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6EC9382C3F; Tue, 6 Jul 2021 00:34: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="VSjAL+6g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B100882C1F; Tue, 6 Jul 2021 00:33:36 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) (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 D945982BFE for ; Tue, 6 Jul 2021 00:33:23 +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-ot1-x331.google.com with SMTP id f12-20020a056830204cb029048bcf4c6bd9so7628367otp.8 for ; Mon, 05 Jul 2021 15:33:23 -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=N83AcRGfr7u1x/oo/XSwpysaFs2qpOYLKXWO7HmF3WA=; b=VSjAL+6gHqJ9GM94i7gilPrC2RSoPH1pWphdTV9/p8iMhy7ggVCC0ewpZ4otRG87bI qTKtbKJnTXkqgGbnno9o6+aT4ulSuTrfSQlSFGB+494FkLQHXTNLsdwKFTCZvNukfy3R 2Te9WFOkHSqcO1R12JG9KxUMy5Osc+ICpi5nQ= 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=N83AcRGfr7u1x/oo/XSwpysaFs2qpOYLKXWO7HmF3WA=; b=cdxcbbNeXfAX/0QZ9Ovue60F7hpRpF3rHDgPL0Pg0Zo6luJmg29f9HfMilUBnngY1B 3UAEX6MBnJ0GLSs1IHYKolBsAHa+HAJ9aIpczCoCj1xb4rYiimppAbKsVSLycHjN95mO pXf05zjE1hM7o7t9oa+jWVJhHxrO14sor1nCgjyb0Ul3s/JmOr72PDGfRp4uWsXvqw2Y OFx/0BK1tmrT7DgXFePuI49RYxyyFQQBfplffoDTPX09kQUMUBqfEhWSEqt+PEIP2qwE r6Q+p5RyrutDghbVdhHlKpCcNZXtl/H1cS+NrY7RJvgtKPdSS6qBNouxTKbdHnzSvASE InNw== X-Gm-Message-State: AOAM531yUKsLoLdw2CmJJlFdUF6aK07oJ2BYSPNFV902V+tCXiuhpaOm gPrfY9KBSgoYBtPpOEsedGcBqbljsEi6ZSj0 X-Google-Smtp-Source: ABdhPJzYMEwOGygPAR/PJL69XzA0HiM3NiK0sssCOlmjjQBQZdpZKo2LCAi1IZxDMM7F0YLo2AvzrA== X-Received: by 2002:a9d:6c8a:: with SMTP id c10mr12446002otr.310.1625524402104; Mon, 05 Jul 2021 15:33:22 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:21 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alper Nebi Yasak , Andy Shevchenko , Heinrich Schuchardt , Pratyush Yadav , Walter Lozano Subject: [PATCH 13/22] cros_ec: Support the full-size vboot context Date: Mon, 5 Jul 2021 16:32:51 -0600 Message-Id: <20210705223300.2139971-12-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean The v2 format is 64-bytes in size. Support this and drop v1 since it is not used anymore. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/misc/cros_ec_sandbox.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index 35e9f4eff44..6a95a9132a6 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -341,15 +341,13 @@ static int process_cmd(struct ec_state *ec, switch (req->op) { case EC_VBNV_CONTEXT_OP_READ: - /* TODO(sjg@chromium.org): Support full-size context */ memcpy(resp->block, ec->vbnv_context, - EC_VBNV_BLOCK_SIZE); - len = 16; + EC_VBNV_BLOCK_SIZE_V2); + len = EC_VBNV_BLOCK_SIZE_V2; break; case EC_VBNV_CONTEXT_OP_WRITE: - /* TODO(sjg@chromium.org): Support full-size context */ memcpy(ec->vbnv_context, req->block, - EC_VBNV_BLOCK_SIZE); + EC_VBNV_BLOCK_SIZE_V2); len = 0; break; default: From patchwork Mon Jul 5 22:32:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500973 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=J0G4rvxz; 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 4GJgVx6rN0z9sWX for ; Tue, 6 Jul 2021 08:35:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E24582C0D; Tue, 6 Jul 2021 00:34: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="J0G4rvxz"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2112382BE4; Tue, 6 Jul 2021 00:33:34 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32c.google.com (mail-ot1-x32c.google.com [IPv6:2607:f8b0:4864:20::32c]) (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 D120782C04 for ; Tue, 6 Jul 2021 00:33: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=sjg@chromium.org Received: by mail-ot1-x32c.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so19670327otq.11 for ; Mon, 05 Jul 2021 15:33:24 -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=9Mp38lZYlvTc0fcS2jJkkexWGDVWGucBdaVevk9km28=; b=J0G4rvxzNmXoEje59Y0LaaoVDDQaEagMX2+9+H8sXLkF/JwUwlee4uiqJgevzhVpfL gfP1pXu5w8XgGHKDj5Dlz5j1G3HrrHJ4B3TvPISQYNRtDs84DtWdmT+Ufiv6qQ+kgyQd lFn6i1GUxpe+OD66+ho3h636RyVvMGoCxoCak= 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=9Mp38lZYlvTc0fcS2jJkkexWGDVWGucBdaVevk9km28=; b=cdjndYpop/h9gukZjpJcWqPfVtNgm2jaU1wyyesFRV1EWiPrxBou+Z4XBik/c/Hzel pSpw+WMgRzvQfJHk2GH6L7NDQXmWC7YAsDN+8911TqZJ3giqs6+GjXgMQhDAMmcYNnFg nbJF+9n+aIMSOcG7pjzaqddRdi8oIkZz+EOMq0g99WbS7SI1c14CvqossMqsfvX3HdLi 1Ce50dBLh1CEB70yl4jXrxSBo0uJpR6v02zYEYp1P9LbpJgAw5qls7W3Na/LM0Q4FbSv Qpv8YswEdEHUbPts8gyLEopEFOFuqdlSXa/3Oy1xT4WAcmtGZInOiMjaYQldhqqLaKTi wvHg== X-Gm-Message-State: AOAM5332+q6mjVZzvfIIUBgGmNidQVoPISuTQM+kkNFf9DEi5qNz6/3P 4vdd0PNo8jfMvKOi/bjcA0bFfImEUy1y0MDb X-Google-Smtp-Source: ABdhPJwyY3Oya+P9wvewxyWNWHu8wvp9Ew59HNRg33Zu57TyigFZ7ac6h5q4CKCsrOun3DdhukBLbg== X-Received: by 2002:a05:6830:18da:: with SMTP id v26mr12135426ote.144.1625524403100; Mon, 05 Jul 2021 15:33:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alper Nebi Yasak , Andy Shevchenko , Heinrich Schuchardt , Pratyush Yadav , Walter Lozano Subject: [PATCH 14/22] cros_ec: Use standard calls for recovery-request checking Date: Mon, 5 Jul 2021 16:32:52 -0600 Message-Id: <20210705223300.2139971-13-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Rather than calling directly into the sandbox SDL code, we can use the normal U-Boot console handling for this feature. Update the code, to make it more generic. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/misc/cros_ec_sandbox.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index 6a95a9132a6..17fca0f9f00 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -622,15 +622,19 @@ void cros_ec_check_keyboard(struct udevice *dev) struct ec_state *ec = dev_get_priv(dev); ulong start; - printf("Press keys for EC to detect on reset (ESC=recovery)..."); + printf("\nPress keys for EC to detect on reset (ESC=recovery)..."); start = get_timer(0); - while (get_timer(start) < 1000) - ; - putc('\n'); - if (!sandbox_sdl_key_pressed(KEY_ESC)) { - ec->recovery_req = true; - printf(" - EC requests recovery\n"); + while (get_timer(start) < 2000) { + if (tstc()) { + int ch = getchar(); + + if (ch == 0x1b) { + ec->recovery_req = true; + printf("EC requests recovery"); + } + } } + putc('\n'); } /* Return the byte of EC switch states */ From patchwork Mon Jul 5 22:32:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500979 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=DI1XO66z; 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 4GJgX56Gv3z9sWX for ; Tue, 6 Jul 2021 08:36:21 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 11C7982C6C; Tue, 6 Jul 2021 00:34:26 +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="DI1XO66z"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6698582C1C; Tue, 6 Jul 2021 00:33:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (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 84C5382A29 for ; Tue, 6 Jul 2021 00:33:25 +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-ot1-x330.google.com with SMTP id r4-20020a0568301204b029047d1030ef5cso12792254otp.12 for ; Mon, 05 Jul 2021 15:33:25 -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=fu4y558FRmG54tx0tXI7N1KEWHvw8kXX1hc0nB89MH0=; b=DI1XO66zMBx9Yc0bnkQAhOgctxmc6bNU6r4D05zCnHyVG6qZY/AIlFLPxf+qxylA0R U2VFnK6BKPBYkizMuXwkllJ92vbE8LxXm7vPO7EEpWwBTfbiAYcMZVtQJpKVfkrmhkhY X3j7XRqQ5zEZbLR66Wkbv17E6cbus/GSZq7Tg= 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=fu4y558FRmG54tx0tXI7N1KEWHvw8kXX1hc0nB89MH0=; b=GoTFvmSb9EfXaxZG6ZovGytUp62WcegcRytI2AiPybojVKp7FIF9zCXNUgENPhRWLF xxt33P4DVP0tb7qjsPs9B4rbCmX50o3OX1toE/0k4ZwQ4h0HIJZDNK25vKa3ybcn67ec YR0Iwh7wG02qAbV+u9GMpSgR4GkAWt/RnzVOXswlf+rR7JwxRwkpwedWEZKY/jtnC7qD fPff7BeUSJHFcXfd3QLXw/IIvDI5BFkT9jH6pc/xr9O7BXJqNKKeXzf20LzDGSNExIcj xZ0nMVfoDoRy68QJ/DDNqvq5sDbxYNwh9QU7Pz0tAm2f/kcHOJtC7/cJl8mSOwp3Xra9 LXXg== X-Gm-Message-State: AOAM531rQ7/xtY3s8LIlW35GPMn8eJ5D8oiUsqD4S+rRgtf5EN4SORWR 5UaJX0HwP4jhtFJGntHO6kCb46S3FRnhOj9E X-Google-Smtp-Source: ABdhPJzErE7EFIDIdneXAmsLNfhi6DFdB1YaEIWWfxGpv1zFmpSoqB8Eg0b4nclU6HOH2NysRB/osQ== X-Received: by 2002:a05:6830:241d:: with SMTP id j29mr12796748ots.371.1625524403952; Mon, 05 Jul 2021 15:33:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:23 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH 15/22] bloblist: Support resizing a blob Date: Mon, 5 Jul 2021 16:32:53 -0600 Message-Id: <20210705223300.2139971-14-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Sometimes a blob needs to expand, e.g. because it needs to hold more log data. Add support for this. Note that the bloblist must have sufficient spare space for this to work. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/bloblist.c | 71 ++++++++++++++++- include/bloblist.h | 13 +++ test/bloblist.c | 192 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 274 insertions(+), 2 deletions(-) diff --git a/common/bloblist.c b/common/bloblist.c index eab63e9ca51..bb49ecab92e 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -57,13 +57,22 @@ static struct bloblist_rec *bloblist_first_blob(struct bloblist_hdr *hdr) return (struct bloblist_rec *)((void *)hdr + hdr->hdr_size); } -static struct bloblist_rec *bloblist_next_blob(struct bloblist_hdr *hdr, - struct bloblist_rec *rec) +static ulong bloblist_blob_end_ofs(struct bloblist_hdr *hdr, + struct bloblist_rec *rec) { ulong offset; offset = (void *)rec - (void *)hdr; offset += rec->hdr_size + ALIGN(rec->size, BLOBLIST_ALIGN); + + return offset; +} + +static struct bloblist_rec *bloblist_next_blob(struct bloblist_hdr *hdr, + struct bloblist_rec *rec) +{ + ulong offset = bloblist_blob_end_ofs(hdr, rec); + if (offset >= hdr->alloced) return NULL; return (struct bloblist_rec *)((void *)hdr + offset); @@ -215,6 +224,64 @@ int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp) return 0; } +static int bloblist_resize_rec(struct bloblist_hdr *hdr, + struct bloblist_rec *rec, + int new_size) +{ + int expand_by; /* Number of bytes to expand by (-ve to contract) */ + int new_alloced; /* New value for @hdr->alloced */ + ulong next_ofs; /* Offset of the record after @rec */ + + expand_by = ALIGN(new_size - rec->size, BLOBLIST_ALIGN); + new_alloced = ALIGN(hdr->alloced + expand_by, BLOBLIST_ALIGN); + if (new_size < 0) { + log(LOGC_BLOBLIST, LOGL_DEBUG, + "Attempt to shrink blob size below 0 (%x)\n", new_size); + return log_msg_ret("size", -EINVAL); + } + if (new_alloced > hdr->size) { + log(LOGC_BLOBLIST, LOGL_ERR, + "Failed to allocate %x bytes size=%x, need size=%x\n", + new_size, hdr->size, new_alloced); + return log_msg_ret("alloc", -ENOSPC); + } + + /* Move the following blobs up or down, if this is not the last */ + next_ofs = bloblist_blob_end_ofs(hdr, rec); + if (next_ofs != hdr->alloced) { + memmove((void *)hdr + next_ofs + expand_by, + (void *)hdr + next_ofs, new_alloced - next_ofs); + } + hdr->alloced = new_alloced; + + /* Zero the new part of the blob */ + if (expand_by > 0) { + memset((void *)rec + rec->hdr_size + rec->size, '\0', + new_size - rec->size); + } + + /* Update the size of this blob */ + rec->size = new_size; + + return 0; +} + +int bloblist_resize(uint tag, int new_size) +{ + struct bloblist_hdr *hdr = gd->bloblist; + struct bloblist_rec *rec; + int ret; + + rec = bloblist_findrec(tag); + if (!rec) + return log_msg_ret("find", -ENOENT); + ret = bloblist_resize_rec(hdr, rec, new_size); + if (ret) + return log_msg_ret("resize", ret); + + return 0; +} + static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) { struct bloblist_rec *rec; diff --git a/include/bloblist.h b/include/bloblist.h index 964b974fdaf..b659d2bc93d 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -179,6 +179,19 @@ void *bloblist_ensure(uint tag, int size); */ int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp); +/** + * bloblist_resize() - resize a blob + * + * Any blobs above this one are relocated up or down. The resized blob remains + * in the same place. + * + * @tag: Tag to add (enum bloblist_tag_t) + * @new_size: New size of the blob (>0 to expand, <0 to contract) + * @return 0 if OK, -ENOSPC if the bloblist does not have enough space, -ENOENT + * if the tag is not found + */ +int bloblist_resize(uint tag, int new_size); + /** * bloblist_new() - Create a new, empty bloblist of a given size * diff --git a/test/bloblist.c b/test/bloblist.c index d876b639184..345eb181fff 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -33,6 +33,9 @@ enum { ERASE_BYTE = '\xff', }; +static const char test1_str[] = "the eyes are open"; +static const char test2_str[] = "the mouth moves"; + static struct bloblist_hdr *clear_bloblist(void) { struct bloblist_hdr *hdr; @@ -384,6 +387,195 @@ static int bloblist_test_reloc(struct unit_test_state *uts) } BLOBLIST_TEST(bloblist_test_reloc, 0); +/* Test expansion of a blob */ +static int bloblist_test_grow(struct unit_test_state *uts) +{ + const uint small_size = 0x20; + void *blob1, *blob2, *blob1_new; + struct bloblist_hdr *hdr; + void *ptr; + + ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE); + hdr = ptr; + memset(hdr, ERASE_BYTE, TEST_BLOBLIST_SIZE); + + /* Create two blobs */ + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + blob1 = bloblist_add(TEST_TAG, small_size, 0); + ut_assertnonnull(blob1); + ut_assertok(check_zero(blob1, small_size)); + strcpy(blob1, test1_str); + + blob2 = bloblist_add(TEST_TAG2, small_size, 0); + ut_assertnonnull(blob2); + strcpy(blob2, test2_str); + + ut_asserteq(sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2, + hdr->alloced); + + /* Resize the first one */ + ut_assertok(bloblist_resize(TEST_TAG, small_size + 4)); + + /* The first one should not have moved, just got larger */ + blob1_new = bloblist_find(TEST_TAG, small_size + 4); + ut_asserteq_ptr(blob1, blob1_new); + + /* The new space should be zeroed */ + ut_assertok(check_zero(blob1 + small_size, 4)); + + /* The second one should have moved */ + blob2 = bloblist_find(TEST_TAG2, small_size); + ut_assertnonnull(blob2); + ut_asserteq_str(test2_str, blob2); + + /* The header should have more bytes in use */ + hdr = ptr; + ut_asserteq(sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2 + + BLOBLIST_ALIGN, + hdr->alloced); + + return 0; +} +BLOBLIST_TEST(bloblist_test_grow, 0); + +/* Test shrinking of a blob */ +static int bloblist_test_shrink(struct unit_test_state *uts) +{ + const uint small_size = 0x20; + void *blob1, *blob2, *blob1_new; + struct bloblist_hdr *hdr; + int new_size; + void *ptr; + + ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE); + + /* Create two blobs */ + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + blob1 = bloblist_add(TEST_TAG, small_size, 0); + ut_assertnonnull(blob1); + strcpy(blob1, test1_str); + + blob2 = bloblist_add(TEST_TAG2, small_size, 0); + ut_assertnonnull(blob2); + strcpy(blob2, test2_str); + + hdr = ptr; + ut_asserteq(sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2, + hdr->alloced); + + /* Resize the first one */ + new_size = small_size - BLOBLIST_ALIGN - 4; + ut_assertok(bloblist_resize(TEST_TAG, new_size)); + + /* The first one should not have moved, just got smaller */ + blob1_new = bloblist_find(TEST_TAG, new_size); + ut_asserteq_ptr(blob1, blob1_new); + + /* The second one should have moved */ + blob2 = bloblist_find(TEST_TAG2, small_size); + ut_assertnonnull(blob2); + ut_asserteq_str(test2_str, blob2); + + /* The header should have fewer bytes in use */ + hdr = ptr; + ut_asserteq(sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2 - + BLOBLIST_ALIGN, + hdr->alloced); + + return 0; +} +BLOBLIST_TEST(bloblist_test_shrink, 0); + +/* Test failing to adjust a blob size */ +static int bloblist_test_resize_fail(struct unit_test_state *uts) +{ + const uint small_size = 0x20; + struct bloblist_hdr *hdr; + void *blob1, *blob2; + int new_size; + void *ptr; + + ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE); + + /* Create two blobs */ + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + blob1 = bloblist_add(TEST_TAG, small_size, 0); + ut_assertnonnull(blob1); + + blob2 = bloblist_add(TEST_TAG2, small_size, 0); + ut_assertnonnull(blob2); + + hdr = ptr; + ut_asserteq(sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2, + hdr->alloced); + + /* Resize the first one, to check the boundary conditions */ + ut_asserteq(-EINVAL, bloblist_resize(TEST_TAG, -1)); + + new_size = small_size + (hdr->size - hdr->alloced); + ut_asserteq(-ENOSPC, bloblist_resize(TEST_TAG, new_size + 1)); + ut_assertok(bloblist_resize(TEST_TAG, new_size)); + + return 0; +} +BLOBLIST_TEST(bloblist_test_resize_fail, 0); + +/* Test expanding the last blob in a bloblist */ +static int bloblist_test_resize_last(struct unit_test_state *uts) +{ + const uint small_size = 0x20; + struct bloblist_hdr *hdr; + void *blob1, *blob2, *blob2_new; + int alloced_val; + void *ptr; + + ptr = map_sysmem(TEST_ADDR, TEST_BLOBLIST_SIZE); + memset(ptr, ERASE_BYTE, TEST_BLOBLIST_SIZE); + hdr = ptr; + + /* Create two blobs */ + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + blob1 = bloblist_add(TEST_TAG, small_size, 0); + ut_assertnonnull(blob1); + + blob2 = bloblist_add(TEST_TAG2, small_size, 0); + ut_assertnonnull(blob2); + + /* Check the byte after the last blob */ + alloced_val = sizeof(struct bloblist_hdr) + + sizeof(struct bloblist_rec) * 2 + small_size * 2; + ut_asserteq(alloced_val, hdr->alloced); + ut_asserteq_ptr((void *)hdr + alloced_val, blob2 + small_size); + ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->alloced)); + + /* Resize the second one, checking nothing changes */ + ut_asserteq(0, bloblist_resize(TEST_TAG2, small_size + 4)); + + blob2_new = bloblist_find(TEST_TAG2, small_size + 4); + ut_asserteq_ptr(blob2, blob2_new); + + /* + * the new blob should encompass the byte we checked now, so it should + * be zeroed. This zeroing should affect only the four new bytes added + * to the blob. + */ + ut_asserteq(0, *((u8 *)hdr + alloced_val)); + ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + alloced_val + 4)); + + /* Check that the new top of the allocated blobs has not been touched */ + alloced_val += BLOBLIST_ALIGN; + ut_asserteq(alloced_val, hdr->alloced); + ut_asserteq((u8)ERASE_BYTE, *((u8 *)hdr + hdr->alloced)); + + return 0; +} +BLOBLIST_TEST(bloblist_test_resize_last, 0); + int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { From patchwork Mon Jul 5 22:32:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500978 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=j9dBsGAS; 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 4GJgWv39yyz9sWX for ; Tue, 6 Jul 2021 08:36:11 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9C33F82C5A; Tue, 6 Jul 2021 00:34: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="j9dBsGAS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 553CD82C29; Tue, 6 Jul 2021 00:33:42 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) (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 7659182BE3 for ; Tue, 6 Jul 2021 00:33:26 +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-ot1-x32b.google.com with SMTP id o13-20020a9d404d0000b0290466630039caso19724723oti.6 for ; Mon, 05 Jul 2021 15:33:26 -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=RCc39BFR1Vyhfw4eBu9wSogf5HNB7lW8Aep1i1QHSNg=; b=j9dBsGASFVW35N0RnYAcUMY0EpOi4JAjnAmtxYLPCYnpGTJc19da2cS0CiSA4Zo7QN LIz9yLn1PqoZQCETOY2uEuBwF+CfHVPPXUK9NSlcQU41f5sPll5fWi+pXzld5EsbjXve nfRStLPbPjRCs/2k+BCmajVoJI1S6Myw9Tud4= 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=RCc39BFR1Vyhfw4eBu9wSogf5HNB7lW8Aep1i1QHSNg=; b=rroJK1qo0XfdhNd/rjxNxvKGZ+oYe3Lh2+3VO6QRAMiazvBNEhYaNtAH38aRO2S8An lYdSyfVBkT+8uILoW6gBwsYH8Cpz4p7+qyaZ51jruAdjLtevB+gfzuXAXc1INH0UI36v jBW24lkKs2jShQ4Q51PhQLebRfewDVZaceEwqBFn0nVU3Cme6mwzqATbhtfo0+SEL84m UQyYAPO8pjebqYJRYZVkMW6M/xyz8p7XKBqkKbIifEq0LF0TKkolzDsV6+8cBPbpNIuG 7pox9m6rCk4JBpXljaVzVHPORWHxy65FqbkkDsqf7NSbarD0i6DkPex4HgR2OIT7uBOV lrSQ== X-Gm-Message-State: AOAM532EBcEW0SGRcGU42hklZxIMEOkatk0DNpDme+s53oHBa2A4uQPV JHKEVJEMO5bvf+deIxxDtsbw0w+U9DBRGWJo X-Google-Smtp-Source: ABdhPJzBnk2nr1etAWUpfHOXmD3s3ThLNA207EzAN4xhsVBwuTdvXlw7eTGRGDFzVBXpTho4F4lWpg== X-Received: by 2002:a9d:69cb:: with SMTP id v11mr12236175oto.304.1625524404818; Mon, 05 Jul 2021 15:33:24 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:24 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng Subject: [PATCH 16/22] bloblist: Tidy up a few API comments Date: Mon, 5 Jul 2021 16:32:54 -0600 Message-Id: <20210705223300.2139971-15-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Some comments for struct bloblist_hdr are a bit ambiguous. Update them to clarify the meaning more precisely. Also document bloblist_get_stats() properly. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- include/bloblist.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/include/bloblist.h b/include/bloblist.h index b659d2bc93d..9f007c7a94d 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -64,10 +64,10 @@ enum bloblist_tag_t { * first bloblist_rec starts at this offset from the start of the header * @flags: Space for BLOBLISTF_... flags (none yet) * @magic: BLOBLIST_MAGIC - * @size: Total size of all records (non-zero if valid) including this header. + * @size: Total size of the bloblist (non-zero if valid) including this header. * The bloblist extends for this many bytes from the start of this header. - * @alloced: Total size allocated for this bloblist. When adding new records, - * the bloblist can grow up to this size. This starts out as + * When adding new records, the bloblist can grow up to this size. + * @alloced: Total size allocated so far for this bloblist. This starts out as * sizeof(bloblist_hdr) since we need at least that much space to store a * valid bloblist * @spare: Spare space (for future use) @@ -230,6 +230,10 @@ int bloblist_finish(void); * bloblist_get_stats() - Get information about the bloblist * * This returns useful information about the bloblist + * + * @basep: Returns base address of bloblist + * @sizep: Returns the number of bytes used in the bloblist + * @allocedp: Returns the total space allocated to the bloblist */ void bloblist_get_stats(ulong *basep, ulong *sizep, ulong *allocedp); From patchwork Mon Jul 5 22:32:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500977 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=AQQyRcBx; 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 4GJgWk0wN6z9sWX for ; Tue, 6 Jul 2021 08:36:01 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E8AC282C5F; Tue, 6 Jul 2021 00:34: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="AQQyRcBx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8153E82BCE; Tue, 6 Jul 2021 00:33:40 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-ot1-x335.google.com (mail-ot1-x335.google.com [IPv6:2607:f8b0:4864:20::335]) (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 3BFAD82BCE for ; Tue, 6 Jul 2021 00:33:27 +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-ot1-x335.google.com with SMTP id h24-20020a9d64180000b029036edcf8f9a6so19712569otl.3 for ; Mon, 05 Jul 2021 15:33:27 -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=B8EJM60ablp5JJ3VU8305p/NOLn1ijtKZV0l58dK0zI=; b=AQQyRcBxZEMDvmQAUfV078c5uv1OAWUzAVeO6fO7TVetZ4Bqce+FYCIXQsJVEl1Or8 ylSSmqGQx9MHE52L8mgZAf4/+lRmOCkhtCCSIMETq80G6/qH97JdoKe4LZYsXx1TXgMH OjiZ1VV1vNbHnFvnAnGTvdRK6zUscLfHowvBc= 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=B8EJM60ablp5JJ3VU8305p/NOLn1ijtKZV0l58dK0zI=; b=Tm0SRPnZtVSvSgMM8GShDnfsK9QV1pGRi4yu4RZVbqGSSDfqrniDXpBl3Mj/Sgp97n SmyKkwPdGjsnnPj0+x1FfOixf5pzEcKamCSJRu4uqZ4SJ9xSMvUG/te3uOV3W3Rbf8uB TpeJml68rbENhy0l5A1hk7LxedwyLBE7FaEO3PaThiwkwjyfZ+ggKvQT3+NqY/23YCXw eqGdSrXpbD8p7ScA5MWZk2OIF1bMOPbzPwDh9ObZhUDl31hY6hGO95DUI9k+3+HlCCT+ UIZuy5Ox0mN6kA/PXFjpnALruyxtWXPrWjDdLz1LmSpeaTj+nDGRi3btI6pLkL1YD9kR mCaw== X-Gm-Message-State: AOAM533u7EWDpauoXNYaMz8ZGs7DH6uD463QNXkprVzds2rW3eZ61pO9 SS0Ko6kOMlvSzEAve1+IYcsTAtDekUjJfQri X-Google-Smtp-Source: ABdhPJwg0FKw9trzqONJFgT5ZRKE9Mn2Tf+RZ3sAPVURubmC6ZQKoRiqBbyZJUgzp3t+o8IEoKTXTw== X-Received: by 2002:a9d:585:: with SMTP id 5mr12883036otd.12.1625524405598; Mon, 05 Jul 2021 15:33:25 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:25 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 17/22] bloblist: Correct condition in bloblist_addrec() Date: Mon, 5 Jul 2021 16:32:55 -0600 Message-Id: <20210705223300.2139971-16-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean It is possible to add a blob that ends at the end of the bloblist, but at present this is not supported. Fix it and add a regression test for this case. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/bloblist.c | 2 +- test/bloblist.c | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/common/bloblist.c b/common/bloblist.c index bb49ecab92e..1290fff8504 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -118,7 +118,7 @@ static int bloblist_addrec(uint tag, int size, int align, /* Calculate the new allocated total */ new_alloced = data_start + ALIGN(size, align); - if (new_alloced >= hdr->size) { + if (new_alloced > hdr->size) { log(LOGC_BLOBLIST, LOGL_ERR, "Failed to allocate %x bytes size=%x, need size=%x\n", size, hdr->size, new_alloced); diff --git a/test/bloblist.c b/test/bloblist.c index 345eb181fff..4104e6a92f6 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -576,6 +576,29 @@ static int bloblist_test_resize_last(struct unit_test_state *uts) } BLOBLIST_TEST(bloblist_test_resize_last, 0); +/* Check a completely full bloblist */ +static int bloblist_test_blob_maxsize(struct unit_test_state *uts) +{ + void *ptr; + int size; + + /* At the start there should be no records */ + clear_bloblist(); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + + /* Add a blob that takes up all space */ + size = TEST_BLOBLIST_SIZE - sizeof(struct bloblist_hdr) - + sizeof(struct bloblist_rec); + ptr = bloblist_add(TEST_TAG, size, 0); + ut_assertnonnull(ptr); + + ptr = bloblist_add(TEST_TAG, size + 1, 0); + ut_assertnull(ptr); + + return 0; +} +BLOBLIST_TEST(bloblist_test_blob_maxsize, 0); + int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) { From patchwork Mon Jul 5 22:32:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500980 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=ZvHEG30C; 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 4GJgXH3Rsbz9sWX for ; Tue, 6 Jul 2021 08:36:31 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B0F6982C25; Tue, 6 Jul 2021 00:34:28 +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="ZvHEG30C"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BFFD182C2A; Tue, 6 Jul 2021 00:33:44 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) (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 5035D82BFD for ; Tue, 6 Jul 2021 00:33:28 +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-ot1-x334.google.com with SMTP id r4-20020a0568301204b029047d1030ef5cso12792335otp.12 for ; Mon, 05 Jul 2021 15:33:28 -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=uSZATpwjIYIWXhsfIFgLRp1FeSo3gm/uAGHY1spWGi8=; b=ZvHEG30CmHilWU2K9djDSmIUhh+r5ptIc0IsONhsaSXHFZYKnJKoh42ZInnGjPrvrA 2lDvT+zh13c3UK3/yAXtQGljXcHCLYh1qGNZG/R8vtcWb142HvNHDqJFgKmjaN25467l Gb+5I80ZVDOQ8aOcWO7yCuiBwsKPH55bbXWnA= 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=uSZATpwjIYIWXhsfIFgLRp1FeSo3gm/uAGHY1spWGi8=; b=reOEqew1gQ3JobIRbRmsFxlrF14RK8/GsBtGd6CjXQ7Dbj/t1NugyRnWOUkyO0tjt/ f7R6+MWxe5r9s5dATy6b6eDBWflLn5vJHUPwv3DRzPGebd8qBPTs3nMKuTVJNDLhlW2+ EkUh0OO9V1Vh5cb8olm4JPure6dkevVG89J8W9/ec9LP6r97XlXxZrpS7C3RU56vfx9h Imbb84hEd85sIRtT/5ZPn1UiEoCZw13q2MYLuMzFp4XnQxqawgxFYGc2u+3zB7812jH2 kWMeT3uZgsSUSKQDMkRFn3+APFS0UYS9dPcWBjHYtJ+HMLro+JhaCKFz5fRuWT2dMOyf 88hQ== X-Gm-Message-State: AOAM531/sE/IjSGfKVZFXlnoPk/uotzjCKlQcxmD9CJLfEQiowJY+DTq 5hpcNIpQ4E7uiQb4hwKBmu/9rC3nBWK/QlsY X-Google-Smtp-Source: ABdhPJyDXFHOMC6FIQDhv24tEnTLBAXlFAVw1R3Se/NOr+iGrUu6pyF5817JusFRYOgrZrQmR7CUyA== X-Received: by 2002:a9d:4d85:: with SMTP id u5mr12490824otk.301.1625524406688; Mon, 05 Jul 2021 15:33:26 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:26 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Alexandru Gagniuc , Joe Hershberger , Joel Stanley , Lokesh Vutla , Marek Vasut , Mark Kettenis , Michal Simek , Sebastian Reichel Subject: [PATCH 18/22] image: Allow @ in node names when not using signatures Date: Mon, 5 Jul 2021 16:32:56 -0600 Message-Id: <20210705223300.2139971-17-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean If signature verification is not in use we don't need to worry about the risk of using @ in node names. Update fit_image_verify() to allow it if the function is not enabled. Signed-off-by: Simon Glass --- common/image-fit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/image-fit.c b/common/image-fit.c index 0c5a05948d1..617375bfe1d 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1376,7 +1376,7 @@ int fit_image_verify(const void *fit, int image_noffset) size_t size; char *err_msg = ""; - if (strchr(name, '@')) { + if (IS_ENABLED(CONFIG_FIT_SIGNATURE) && strchr(name, '@')) { /* * We don't support this since libfdt considers names with the * name root but different @ suffix to be equal From patchwork Mon Jul 5 22:32:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500982 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=jhdhCBJs; 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 4GJgXg4XTqz9sWX for ; Tue, 6 Jul 2021 08:36:51 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6353C82C74; Tue, 6 Jul 2021 00:34:34 +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="jhdhCBJs"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 05B2482C1C; Tue, 6 Jul 2021 00:33:50 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 C7A2A82C08 for ; Tue, 6 Jul 2021 00:33:29 +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-oi1-x229.google.com with SMTP id w127so22290019oig.12 for ; Mon, 05 Jul 2021 15:33:29 -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=+FOblgwANXbtXS9JwvHWqXsejnEZocrkUxltxhrgMlw=; b=jhdhCBJsPwVhoSJO4YrqKUsZ9NdyiUaAzvdiYDsTk2qw6PIHeW6QDbbgGh16E4nrC3 oE2ND+B0ynaLZLogXgQhv4EEkNJG1XZ5NUWeuWmp9+5tZfWlPL2Vmh18zzhAbPbxHcBK 5hcJP9NIUDTBoVvVmqgO+1UOlPsGq0dEIepyQ= 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=+FOblgwANXbtXS9JwvHWqXsejnEZocrkUxltxhrgMlw=; b=qWFP2XoEVpQvCyBAbDp+FjYgDKt9kO6joe80ma+vVc/qidKV8HKjEDt7yxIW6lUKa/ WBdRB8talFolxTHzqBbQ93b3rdWcp33MGVvJUHlXaVF3pI7ukwXTSfXs2yIMO3r08j5k 8dbH7YId8IzOtKOh6XgCrcLjc40we5xU2eOx5jXjqj2awMUGUfcVxFFpHigQkdPFXvvz nnsj+oroXtgblF/9BkOQz4IhjdVNGwodTFEh0xCsFzhrvCWZqcWhV3/2T17DisNPmAWm l8ItCDMvpsHQ1y5tVfvhPDVHS/0O7kp+lwTlg50JQI0NvIto/4No0Jdgtmh4kfnx81yB nD2w== X-Gm-Message-State: AOAM532adC2N/znOWgq4GQaryKhmNteplEVYsfauSCYxwIjFFby5q/Ha AlFTKaVHElygIogTJ+HEzh0CcQ9Rt00HAHhh X-Google-Smtp-Source: ABdhPJztt95lU4wG56IXQa1NH2GP4+Bd7r3ZiSpyJ1dMcXaUyxuM/tZcvT9Tsqn16i72G8OGqnhIdA== X-Received: by 2002:aca:ef06:: with SMTP id n6mr11782838oih.66.1625524408025; Mon, 05 Jul 2021 15:33:28 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:27 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Adam Ford , Alexandru Gagniuc , Andre Przywara , Dario Binacchi , Faiz Abbas , Masahiro Yamada , Michael Walle , Michal Simek , Otavio Salvador , Ovidiu Panait , Peng Fan , Philippe Reynes , Samuel Holland , Stefan Roese Subject: [PATCH 19/22] spl: Provide more information on boot failure Date: Mon, 5 Jul 2021 16:32:57 -0600 Message-Id: <20210705223300.2139971-18-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean If SPL fails to boot, try to provide an error code to indicate what is wrong. For example, if a uclass is missing, this can return -EPFNOSUPPORT (-96) which provides useful information. Add a helper for accessing the image-loader name so we can drop the use of #ifdefs in this code. Put this feature behind a CONFIG_SHOW_ERRORS option to avoid increasing the code size. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/spl/Kconfig | 10 ++++++++++ common/spl/spl.c | 48 ++++++++++++++++++++++++++++++---------------- include/spl.h | 10 ++++++++++ 3 files changed, 52 insertions(+), 16 deletions(-) diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 1de9b912c3f..26c0ab58531 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -94,6 +94,16 @@ config SPL_SYS_REPORT_STACK_F_USAGE occurrence of non 0xaa bytes. This default implementation works for stacks growing down only. +config SPL_SHOW_ERRORS + bool "Show more information when something goes wrong" + help + This enabled more verbose error messages and checking when something + goes wrong in SPL. For example, it shows the error code when U-Boot + cannot be located. This can help to diagnose the problem and figure + out a fix, particularly during development. + + This adds a small amount to SPL code size, perhaps 100 bytes. + menu "PowerPC and LayerScape SPL Boot options" config SPL_NAND_BOOT diff --git a/common/spl/spl.c b/common/spl/spl.c index cd428c1cbc9..6fe6483f7f4 100644 --- a/common/spl/spl.c +++ b/common/spl/spl.c @@ -610,32 +610,42 @@ static int spl_load_image(struct spl_image_info *spl_image, * @spl_image: Place to put the image details if successful * @spl_boot_list: List of boot devices to try * @count: Number of elements in spl_boot_list - * @return 0 if OK, -ve on error + * @return 0 if OK, -ENODEV if there were no boot devices + * if CONFIG_SHOW_ERRORS is enabled, returns -ENXIO if there were + * devices but none worked */ static int boot_from_devices(struct spl_image_info *spl_image, u32 spl_boot_list[], int count) { + int ret = -ENODEV; int i; for (i = 0; i < count && spl_boot_list[i] != BOOT_DEVICE_NONE; i++) { struct spl_image_loader *loader; - - loader = spl_ll_find_loader(spl_boot_list[i]); -#if defined(CONFIG_SPL_SERIAL_SUPPORT) \ - && defined(CONFIG_SPL_LIBCOMMON_SUPPORT) \ - && !defined(CONFIG_SILENT_CONSOLE) - if (loader) - printf("Trying to boot from %s\n", loader->name); - else - puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n"); -#endif + int bootdev = spl_boot_list[i]; + + if (CONFIG_IS_ENABLED(SHOW_ERRORS)) + ret = -ENXIO; + loader = spl_ll_find_loader(bootdev); + if (CONFIG_IS_ENABLED(SERIAL_SUPPORT) && + CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT) && + !IS_ENABLED(CONFIG_SILENT_CONSOLE)) { + if (loader) + printf("Trying to boot from %s\n", + spl_loader_name(loader)); + else if (CONFIG_IS_ENABLED(SHOW_ERRORS)) + printf(SPL_TPL_PROMPT + "Unsupported Boot Device %d\n", bootdev); + else + puts(SPL_TPL_PROMPT "Unsupported Boot Device!\n"); + } if (loader && !spl_load_image(spl_image, loader)) { - spl_image->boot_device = spl_boot_list[i]; + spl_image->boot_device = bootdev; return 0; } } - return -ENODEV; + return ret; } #if defined(CONFIG_SPL_FRAMEWORK_BOARD_INIT_F) @@ -727,9 +737,15 @@ void board_init_r(gd_t *dummy1, ulong dummy2) spl_image.boot_device = BOOT_DEVICE_NONE; board_boot_order(spl_boot_list); - if (boot_from_devices(&spl_image, spl_boot_list, - ARRAY_SIZE(spl_boot_list))) { - puts(SPL_TPL_PROMPT "failed to boot from all boot devices\n"); + ret = boot_from_devices(&spl_image, spl_boot_list, + ARRAY_SIZE(spl_boot_list)); + if (ret) { + if (CONFIG_IS_ENABLED(SHOW_ERRORS) && + CONFIG_IS_ENABLED(LIBCOMMON_SUPPORT)) + printf(SPL_TPL_PROMPT "failed to boot from all boot devices (err=%d)\n", + ret); + else + puts(SPL_TPL_PROMPT "failed to boot from all boot devices\n"); hang(); } diff --git a/include/spl.h b/include/spl.h index cf77d379da2..8359dffd212 100644 --- a/include/spl.h +++ b/include/spl.h @@ -498,6 +498,16 @@ struct spl_image_loader { struct spl_boot_device *bootdev); }; +/* Helper function for accessing the name */ +static inline const char *spl_loader_name(const struct spl_image_loader *loader) +{ +#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT + return loader->name; +#else + return NULL; +#endif +} + /* Declare an SPL image loader */ #define SPL_LOAD_IMAGE(__name) \ ll_entry_declare(struct spl_image_loader, __name, spl_image_loader) From patchwork Mon Jul 5 22:32:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500981 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=nz/Fr7qh; 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 4GJgXT18ZKz9sWX for ; Tue, 6 Jul 2021 08:36:41 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id CC5B982C68; Tue, 6 Jul 2021 00:34:31 +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="nz/Fr7qh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 2C9B182C2A; Tue, 6 Jul 2021 00:33:49 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x229.google.com (mail-oi1-x229.google.com [IPv6:2607:f8b0:4864:20::229]) (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 DF90282BFB for ; Tue, 6 Jul 2021 00:33:30 +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-oi1-x229.google.com with SMTP id q23so22276882oiw.11 for ; Mon, 05 Jul 2021 15:33:30 -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=G4SZEvT6Xs7dOMq+fSdXWi44KCK2wZckbBOFVVafriY=; b=nz/Fr7qhjQtFYdVhznluKlMhJ9KM/XBSCitgV6iDA1fBp/GBC9W/rX/NPfAes+s3jx Zj9qaFEAmOH7uyIK5DgG8a43wqw5FMvDMXGeBfgliwOJKLzt6Z6dYzsDb3+/b16KumK8 VdyeJs16XLWVWiiZon/NJCQ9KNMA4cbhfj1tM= 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=G4SZEvT6Xs7dOMq+fSdXWi44KCK2wZckbBOFVVafriY=; b=JKQ7WHk7PSYx+i4+tf1DoW/9hK2Z/cg12vSNTEUoPA3V/GOwYb7qufwH31K5OxgOxO pyHHcsDx8Nd8go3H9n4M6Jr5jp7ivQTBP3ILqv12ie2sKGucTvOVoH455Pd4Hoak26Jf Wsy9M5VMU+/yfd4eK/9+7I6tAn9a4+gMU8P5DpObvY/eBr6RJYf4ZjZytl2upmOl+ORu 5qFNT8zxglNtLgcBrWcxtGTddeC5UWRdTvku+4FkwGUomU4TnFageDbeodCbuliBJ+Lk RaquBBCz5du8QgZG830nwO1tMm5kbZFVPcE4ZqeV1gGsw8VZl+TYe04VDvmN7LddNvnY tRiQ== X-Gm-Message-State: AOAM532SZ3IE3tquIDYw8IgazIGCDVDKtjlo+mDI/E65+a3frE0owBJ9 JSLYV89FysX05RTJM7G3NIKO29I2kfiyv4qs X-Google-Smtp-Source: ABdhPJxFKGyhUuKwpUx28cpcHRAZ9f48eFjs0pgWDT9JupaPp7t84XYpom0MOYTXeNYFMtdCqFQGLw== X-Received: by 2002:aca:f446:: with SMTP id s67mr1098745oih.86.1625524409168; Mon, 05 Jul 2021 15:33:29 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Bin Meng , Claudiu Manoil , Dario Binacchi , Etienne Carriere , Jaehoon Chung , Jean-Jacques Hiblot , Michael Walle , Peng Fan , Sean Anderson , Wolfgang Wallner Subject: [PATCH 20/22] sandbox: mmc: Support fixed MMC devices Date: Mon, 5 Jul 2021 16:32:58 -0600 Message-Id: <20210705223300.2139971-19-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean Add support for reading devicetree flags for MMC devices. With this we can distinguish between fixed and removable drives. Note that this information is only available when the device is probed, not when it is bound, since it is read in the of_to_plat() method. This could be changed if needed later. Signed-off-by: Simon Glass Reviewed-by: Jaehoon Chung Reviewed-by: Jaehoon Chung --- arch/sandbox/dts/test.dts | 1 + drivers/mmc/sandbox_mmc.c | 24 +++++++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index d85bb46ceba..0cee15a0ea2 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -819,6 +819,7 @@ mmc2 { compatible = "sandbox,mmc"; + non-removable; }; mmc1 { diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c index 18ba020aacc..895fbffecfc 100644 --- a/drivers/mmc/sandbox_mmc.c +++ b/drivers/mmc/sandbox_mmc.c @@ -136,14 +136,31 @@ static const struct dm_mmc_ops sandbox_mmc_ops = { .get_cd = sandbox_mmc_get_cd, }; -int sandbox_mmc_probe(struct udevice *dev) +static int sandbox_mmc_of_to_plat(struct udevice *dev) +{ + struct sandbox_mmc_plat *plat = dev_get_plat(dev); + struct mmc_config *cfg = &plat->cfg; + struct blk_desc *blk; + int ret; + + ret = mmc_of_parse(dev, cfg); + if (ret) + return ret; + blk = mmc_get_blk_desc(&plat->mmc); + if (blk) + blk->removable = !(cfg->host_caps & MMC_CAP_NONREMOVABLE); + + return 0; +} + +static int sandbox_mmc_probe(struct udevice *dev) { struct sandbox_mmc_plat *plat = dev_get_plat(dev); return mmc_init(&plat->mmc); } -int sandbox_mmc_bind(struct udevice *dev) +static int sandbox_mmc_bind(struct udevice *dev) { struct sandbox_mmc_plat *plat = dev_get_plat(dev); struct mmc_config *cfg = &plat->cfg; @@ -158,7 +175,7 @@ int sandbox_mmc_bind(struct udevice *dev) return mmc_bind(dev, &plat->mmc, cfg); } -int sandbox_mmc_unbind(struct udevice *dev) +static int sandbox_mmc_unbind(struct udevice *dev) { mmc_unbind(dev); @@ -177,6 +194,7 @@ U_BOOT_DRIVER(mmc_sandbox) = { .ops = &sandbox_mmc_ops, .bind = sandbox_mmc_bind, .unbind = sandbox_mmc_unbind, + .of_to_plat = sandbox_mmc_of_to_plat, .probe = sandbox_mmc_probe, .priv_auto = sizeof(struct sandbox_mmc_priv), .plat_auto = sizeof(struct sandbox_mmc_plat), From patchwork Mon Jul 5 22:32:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500983 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=glWXpelB; 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 4GJgXr4v5Hz9sWX for ; Tue, 6 Jul 2021 08:37:00 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8D0AE82C85; Tue, 6 Jul 2021 00:34:37 +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="glWXpelB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC05282C1C; Tue, 6 Jul 2021 00:33:51 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) (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 EC3A282BFF for ; Tue, 6 Jul 2021 00:33:31 +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-oo1-xc30.google.com with SMTP id i26-20020a4ad39a0000b02902554d87361cso1518193oos.13 for ; Mon, 05 Jul 2021 15:33:31 -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=A3ombogXF8UOOuHEaB9YJSW4jiogZkHYs7TpL94QWDs=; b=glWXpelBe8jGqPuR/Qt8774xgX7ZzEpB3sOaCz7jhCqD4lPRUwbME39+//m0YdZSZW uF7mvt5Awf4Gx3anJd4opH69J8QibM9KSxY4T3AzXD6nq00nOv6TA7AalTWVKq4jI1xQ 3GMhpck36X/ppfpXtQS+6GulMM7ry7+HEdVb8= 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=A3ombogXF8UOOuHEaB9YJSW4jiogZkHYs7TpL94QWDs=; b=HHc8QRuWKOrLDyU4WSlh+PMo2Op8TQ8Plkufy5y0aD/gXpsVZ+1s6byWv1YmqjV5uL oCQtfTxAhZU+wGtXgR1v0g2NoMCDvoIEXSstOX1AvWIlCMaaMEogP2mott4VE+OMFcpU dtKpCWtimlo5Pesyrz9+boDwu9UTlEnPXs/SGg3iejmcq4W5Lo+/PJSkJtY3L5TPrnxe 7tw7lTDUSzGkCWbPtxgY3e+h4OMfs5cyKXbJi0lyQpU+BxrzAz6ixvAudTYS/VO2prhC OFKK6UoRgJR+Qt1Rim0xv+GAV1aPUt5EV5sTBoNupDu477agdiLfvfaRiG3xM3w48wYA ychw== X-Gm-Message-State: AOAM5336DK9h5ZnVw1yWKMt9S+Wj4Ra6/1Ki9Aw4zv6NnMfQD80Bae0K ozSzE2gGIiq4l+K5ae2BlMsbQih9Q78oSg8k X-Google-Smtp-Source: ABdhPJy/mH29+QKOhHZGMDxHye2N8hzAwb1u413nQmxk/0/m7NtdFN/qwW5M19biibQ6D02Ed3rTxw== X-Received: by 2002:a05:6820:168:: with SMTP id k8mr11545529ood.76.1625524410132; Mon, 05 Jul 2021 15:33:30 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , Anastasiia Lukianenko , Andrii Anisov , Oleksandr Andrushchenko , Ovidiu Panait , Patrick Delaunay Subject: [PATCH 21/22] blk: Support iteration Date: Mon, 5 Jul 2021 16:32:59 -0600 Message-Id: <20210705223300.2139971-20-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean It is useful to be able to iterate over block devices. Typically there are fixed and removable devices. For security reasons it is sometimes useful to ignore removable devices since they are under user control. Add iterators which support selecting the block-device type. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- drivers/block/blk-uclass.c | 49 +++++++++++++++++++++++++++++++++ include/blk.h | 56 ++++++++++++++++++++++++++++++++++++++ test/dm/blk.c | 55 +++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+) diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index dfc0d469702..83682dcc181 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -540,6 +540,55 @@ int blk_next_free_devnum(enum if_type if_type) return ret + 1; } +static int blk_flags_check(struct udevice *dev, enum blk_flag_t req_flags) +{ + const struct blk_desc *desc = dev_get_uclass_plat(dev); + enum blk_flag_t flags; + + flags = desc->removable ? BLKF_REMOVABLE : BLKF_FIXED; + + return flags & req_flags ? 0 : 1; +} + +int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp) +{ + int ret; + + for (ret = uclass_first_device_err(UCLASS_BLK, devp); + !ret; + ret = uclass_next_device_err(devp)) { + if (!blk_flags_check(*devp, flags)) + return 0; + } + + return -ENODEV; +} + +int blk_next_device_err(enum blk_flag_t flags, struct udevice **devp) +{ + int ret; + + for (ret = uclass_next_device_err(devp); + !ret; + ret = uclass_next_device_err(devp)) { + if (!blk_flags_check(*devp, flags)) + return 0; + } + + return -ENODEV; +} + +int blk_count_devices(enum blk_flag_t flag) +{ + struct udevice *dev; + int count = 0; + + blk_foreach_probe(flag, dev) + count++; + + return count; +} + static int blk_claim_devnum(enum if_type if_type, int devnum) { struct udevice *dev; diff --git a/include/blk.h b/include/blk.h index c4401b00253..19bab081c2c 100644 --- a/include/blk.h +++ b/include/blk.h @@ -19,6 +19,8 @@ typedef ulong lbaint_t; #define LBAF "%" LBAFlength "x" #define LBAFU "%" LBAFlength "u" +struct udevice; + /* Interface types: */ enum if_type { IF_TYPE_UNKNOWN = 0, @@ -683,4 +685,58 @@ const char *blk_get_if_type_name(enum if_type if_type); int blk_common_cmd(int argc, char *const argv[], enum if_type if_type, int *cur_devnump); +enum blk_flag_t { + BLKF_FIXED = 1 << 0, + BLKF_REMOVABLE = 1 << 1, + BLKF_BOTH = BLKF_FIXED | BLKF_REMOVABLE, +}; + +/** + * blk_first_device_err() - Get the first block device + * + * The device returned is probed if necessary, and ready for use + * + * @flags: Indicates type of device to return + * @devp: Returns pointer to the first device in that uclass, or NULL if none + * @return 0 if found, -ENODEV if not found, other -ve on error + */ +int blk_first_device_err(enum blk_flag_t flags, struct udevice **devp); + +/** + * blk_next_device_err() - Get the next block device + * + * The device returned is probed if necessary, and ready for use + * + * @flags: Indicates type of device to return + * @devp: On entry, pointer to device to lookup. On exit, returns pointer + * to the next device in the uclass if no error occurred, or -ENODEV if + * there is no next device. + * @return 0 if found, -ENODEV if not found, other -ve on error + */ +int blk_next_device_err(enum blk_flag_t flags, struct udevice **devp); + +/** + * blk_foreach_probe() - Helper function to iteration through block devices + * + * This creates a for() loop which works through the available devices in + * a uclass in order from start to end. Devices are probed if necessary, + * and ready for use. + * + * @flags: Indicates type of device to return + * @dev: struct udevice * to hold the current device. Set to NULL when there + * are no more devices. + */ +#define blk_foreach_probe(flags, pos) \ + for (int _ret = blk_first_device_err(flags, &(pos)); \ + !_ret && pos; \ + _ret = blk_next_device_err(flags, &(pos))) + +/** + * blk_count_devices() - count the number of devices of a particular type + * + * @flags: Indicates type of device to find + * @return number of devices matching those flags + */ +int blk_count_devices(enum blk_flag_t flag); + #endif diff --git a/test/dm/blk.c b/test/dm/blk.c index b7f4304e9e9..deccf05289b 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -162,3 +162,58 @@ static int dm_test_blk_get_from_parent(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_blk_get_from_parent, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); + +/* Test iteration through block devices */ +static int dm_test_blk_iter(struct unit_test_state *uts) +{ + struct udevice *dev; + int i; + + /* + * See sandbox test.dts - it has: + * + * mmc0 - removable + * mmc1 - removable + * mmc2 - fixed + */ + ut_assertok(blk_first_device_err(BLKF_FIXED, &dev)); + ut_asserteq_str("mmc2.blk", dev->name); + ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev)); + + ut_assertok(blk_first_device_err(BLKF_REMOVABLE, &dev)); + ut_asserteq_str("mmc1.blk", dev->name); + ut_assertok(blk_next_device_err(BLKF_REMOVABLE, &dev)); + ut_asserteq_str("mmc0.blk", dev->name); + ut_asserteq(-ENODEV, blk_next_device_err(BLKF_REMOVABLE, &dev)); + + ut_assertok(blk_first_device_err(BLKF_BOTH, &dev)); + ut_asserteq_str("mmc2.blk", dev->name); + ut_assertok(blk_next_device_err(BLKF_BOTH, &dev)); + ut_asserteq_str("mmc1.blk", dev->name); + ut_assertok(blk_next_device_err(BLKF_BOTH, &dev)); + ut_asserteq_str("mmc0.blk", dev->name); + ut_asserteq(-ENODEV, blk_next_device_err(BLKF_FIXED, &dev)); + + ut_asserteq(1, blk_count_devices(BLKF_FIXED)); + ut_asserteq(2, blk_count_devices(BLKF_REMOVABLE)); + ut_asserteq(3, blk_count_devices(BLKF_BOTH)); + + i = 0; + blk_foreach_probe(BLKF_FIXED, dev) + ut_asserteq_str((i++, "mmc2.blk"), dev->name); + ut_asserteq(1, i); + + i = 0; + blk_foreach_probe(BLKF_REMOVABLE, dev) + ut_asserteq_str(i++ ? "mmc0.blk" : "mmc1.blk", dev->name); + ut_asserteq(2, i); + + i = 0; + blk_foreach_probe(BLKF_BOTH, dev) + ut_asserteq_str((++i == 1 ? "mmc2.blk" : i == 2 ? + "mmc1.blk" : "mmc0.blk"), dev->name); + ut_asserteq(3, i); + + return 0; +} +DM_TEST(dm_test_blk_iter, UT_TESTF_SCAN_PDATA | UT_TESTF_SCAN_FDT); From patchwork Mon Jul 5 22:33:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1500984 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; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=IR4tJF6c; 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 4GJgY20kBlz9sWX for ; Tue, 6 Jul 2021 08:37:09 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E910982C81; Tue, 6 Jul 2021 00:34:40 +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="IR4tJF6c"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 03DF982C45; Tue, 6 Jul 2021 00:33:53 +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=-3.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc35.google.com (mail-oo1-xc35.google.com [IPv6:2607:f8b0:4864:20::c35]) (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 A7FCD82C0D for ; Tue, 6 Jul 2021 00:33:32 +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-oo1-xc35.google.com with SMTP id 68-20020a4a00470000b0290258a7ff4058so647694ooh.10 for ; Mon, 05 Jul 2021 15:33:32 -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=KYDxMM73iyaN6GY82MIpAUdI5TKERlNp3yobhJrJr7Y=; b=IR4tJF6c693uPCIImm7PzfNVvhBEPGeQOiQT8muXbfK/RU9+JDhpgdXCirfEpTta/i K2C1aFZMb5vUceUtM/j9fVpeYeEbZeZPUHUmiyYhEJywhya2zv9woyqPWo2GTlkTDrSm NERNa76VlJK9bu/r/6VF9fZXPBKlYqOVdCSyA= 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=KYDxMM73iyaN6GY82MIpAUdI5TKERlNp3yobhJrJr7Y=; b=GgIU8NYBCVVjnv55a7zi6Z+NZTFWOgbRgIcyMUmkJgbGafBA2iX6YTeZgmRUljR54X kDmQCQOSprDUl3pCvcV+0CIXOuHszYo3X0bWJYOu3ca5/aJnExjFwbmtNMzGuXO7fFPM aW36lu5EzRzzy2mrhIdF6/n1X384ayi8jfrP9rVhTB8vY8Ag5i9rTcKrxK8jRxxPjUB4 W++vZsaTFG9hGWAGmd9txPjLC+uU4zr52dyNv6UYsN6usiHy9UL17sIVQA4l1t3vBOy8 NzCpjsLL7+1m0pKWVeaScrcPgUIVx6o/toASdUUv+Y0AAq0o5kGXoMLGV1oHoQLcyKhm GaMw== X-Gm-Message-State: AOAM5301w7PMaL+PCMwaB/uM2deu24p4+ezx9/7YlLX5ZHiHhPJ86PJ3 PtnBsJ1s8XHFdjlgZGMG0pRfirSB9VzS1oy3 X-Google-Smtp-Source: ABdhPJybDvr0lydOkP4IORnqhQscUOnPn1XovWxkgW3EB0jgtdVEbTP0pmFzAu+8FWzYbA4BfBj03g== X-Received: by 2002:a4a:e989:: with SMTP id s9mr11656049ood.44.1625524411102; Mon, 05 Jul 2021 15:33:31 -0700 (PDT) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id u22sm1434938oie.26.2021.07.05.15.33.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Jul 2021 15:33:30 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass , AKASHI Takahiro , Heinrich Schuchardt , Igor Opaniuk , Joel Peshkin , Usama Arif Subject: [PATCH 22/22] log: Allow padding of the function name Date: Mon, 5 Jul 2021 16:33:00 -0600 Message-Id: <20210705223300.2139971-21-sjg@chromium.org> X-Mailer: git-send-email 2.32.0.93.g670b81a890-goog In-Reply-To: <20210705223300.2139971-1-sjg@chromium.org> References: <20210705223300.2139971-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.103.2 at phobos.denx.de X-Virus-Status: Clean At present when function names are logged, the output is a little hard to read since every function is a different length. Add a way to pad the names so that the log messages line up vertically. This doesn't work if the function name is very long, but it makes a big difference in most cases. Use 20 characters as a default since this covers the vast majority of functions. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- common/Kconfig | 8 ++++++++ common/log_console.c | 2 +- test/log/log_test.c | 16 +++++++++------- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/common/Kconfig b/common/Kconfig index 21407b547da..b77e17b5cbd 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -340,6 +340,14 @@ config LOGF_FUNC Show the function name in log messages by default. This value can be overridden using the 'log format' command. +config LOGF_FUNC_PAD + int "Number of characters to use for function" + default 20 + help + Sets the field width to use when showing the function. Set this to + a larger value if you have lots of long function names, and want + things to line up. + config LOG_SYSLOG bool "Log output to syslog server" depends on NET diff --git a/common/log_console.c b/common/log_console.c index 3f6177499ef..f1dcc04b97c 100644 --- a/common/log_console.c +++ b/common/log_console.c @@ -38,7 +38,7 @@ static int log_console_emit(struct log_device *ldev, struct log_rec *rec) if (fmt & BIT(LOGF_LINE)) printf("%d-", rec->line); if (fmt & BIT(LOGF_FUNC)) - printf("%s()", rec->func); + printf("%*s()", CONFIG_LOGF_FUNC_PAD, rec->func); } if (fmt & BIT(LOGF_MSG)) printf("%s%s", add_space ? " " : "", rec->msg); diff --git a/test/log/log_test.c b/test/log/log_test.c index f1e67509c17..db7170f3042 100644 --- a/test/log/log_test.c +++ b/test/log/log_test.c @@ -62,9 +62,9 @@ static int do_check_log_entries(struct unit_test_state *uts, int flags, int min, for (i = min; i <= max; i++) { if (flags & EXPECT_LOG) - ut_assert_nextline("do_log_run() log %d", i); + ut_assert_nextline(" do_log_run() log %d", i); if (flags & EXPECT_DIRECT) - ut_assert_nextline("func() _log %d", i); + ut_assert_nextline(" func() _log %d", i); if (flags & EXPECT_DEBUG) { ut_assert_nextline("log %d", i); ut_assert_nextline("_log %d", i); @@ -72,11 +72,12 @@ static int do_check_log_entries(struct unit_test_state *uts, int flags, int min, } if (flags & EXPECT_EXTRA) for (; i <= LOGL_MAX ; i++) - ut_assert_nextline("func() _log %d", i); + ut_assert_nextline(" func() _log %d", i); for (i = LOGL_FIRST; i < LOGL_COUNT; i++) { if (flags & EXPECT_FORCE) - ut_assert_nextline("func() _log force %d", i); + ut_assert_nextline(" func() _log force %d", + i); if (flags & EXPECT_DEBUG) ut_assert_nextline("_log force %d", i); } @@ -277,7 +278,8 @@ int do_log_test_helpers(struct unit_test_state *uts) log_io("level %d\n", LOGL_DEBUG_IO); for (i = LOGL_EMERG; i <= _LOG_MAX_LEVEL; i++) - ut_assert_nextline("%s() level %d", __func__, i); + ut_assert_nextline("%*s() level %d", CONFIG_LOGF_FUNC_PAD, + __func__, i); ut_assert_console_end(); return 0; } @@ -297,14 +299,14 @@ int do_log_test_disable(struct unit_test_state *uts) { ut_assertok(console_record_reset_enable()); log_err("default\n"); - ut_assert_nextline("%s() default", __func__); + ut_assert_nextline("%*s() default", CONFIG_LOGF_FUNC_PAD, __func__); ut_assertok(log_device_set_enable(LOG_GET_DRIVER(console), false)); log_err("disabled\n"); ut_assertok(log_device_set_enable(LOG_GET_DRIVER(console), true)); log_err("enabled\n"); - ut_assert_nextline("%s() enabled", __func__); + ut_assert_nextline("%*s() enabled", CONFIG_LOGF_FUNC_PAD, __func__); ut_assert_console_end(); return 0; }