From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 12D2DC54EE9 for ; Sun, 25 Sep 2022 15:08:43 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 281FF84D8E; Sun, 25 Sep 2022 17:04:44 +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="P2rbcnuG"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 0FE2184C60; Sun, 25 Sep 2022 17:03:55 +0200 (CEST) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id B528084BE3 for ; Sun, 25 Sep 2022 17:03:51 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd2b.google.com with SMTP id n192so2243236iod.3 for ; Sun, 25 Sep 2022 08:03:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=87YinNvoWZkr3uhDADxWPabggMjMZDdBK9GQ+QkkStE=; b=P2rbcnuGUVZkw+NZMoyYkd2f4lZoXPiYtYtkhGvH2QR/sgIx5xl34hNx5iPzq1MnCl tfj8sy9Kd4HqVn+1IJHOrc6tS8iYOeHi6S5V3RhiRpMhNB8z2eKHPhB9KmdJe+Cacxds JZIz37XUBFDPOww4ID5rT4+FLlfN3tMGJFems= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=87YinNvoWZkr3uhDADxWPabggMjMZDdBK9GQ+QkkStE=; b=zuc9TuWoBYc0UlLlyqoryjHJd32TGhB17ymYa6STlcKqM3NFD1oA5cEf0xmD1mZDZQ VEGKYv2sv/MHaCctaj+EfA7G5TOjfJ/c4UPQsexc3JAJd5hrna5U8Tn4icsGTyxvBJyO zYyowEG2rj05QMylWjwSOOROb7F5y9t0LOfBzDZ/I75yrNv9jdPhxn5v9rJRGIS95n8k yVnc2vZHI6+xKPzwQlkKJ8kHNHrRN2LvUulHWthC/pYI26rWgw1U6RrWeg8uCtbPhA/j uX4KBaGG26RAYAZUfLvoVpKLLqMSt9voRtUzztZR+yYNcu7cGfNG/f3Ay040qlLP/hsP GWtA== X-Gm-Message-State: ACrzQf2LAX3H1BqUD5c96Bb0fgHhPGNByZ+pLntQG440wqN561hVoRyM dbeEk5lqgUWO+mHCnQKSFBrKfcCAJQV/JQ== X-Google-Smtp-Source: AMsMyM4XBDmIAkD9aF0UJeb+JyMdHLF0p2J8Wvywpyr+NelmO5ShiG8nEGztZR7Y1Z5Lf8Xh54A+vQ== X-Received: by 2002:a05:6638:2402:b0:35a:1e83:e43b with SMTP id z2-20020a056638240200b0035a1e83e43bmr9737879jat.146.1664118230920; Sun, 25 Sep 2022 08:03:50 -0700 (PDT) Received: from sjg1.roam.corp.google.com (c-67-190-102-125.hsd1.co.comcast.net. [67.190.102.125]) by smtp.gmail.com with ESMTPSA id u19-20020a926013000000b002f19d9838c6sm5360578ilb.25.2022.09.25.08.03.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Sep 2022 08:03:50 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass , Andrew Scull , Etienne Carriere , Heinrich Schuchardt , =?UTF-8?q?Marek=20Beh=C3=BAn?= , Ramon Fried , Sean Anderson Subject: [PATCH 38/45] vbe: Add info about the VBE device to the fwupd node Date: Sun, 25 Sep 2022 09:02:41 -0600 Message-Id: <20220925150248.2524421-39-sjg@chromium.org> X-Mailer: git-send-email 2.37.3.998.g577e59143f-goog In-Reply-To: <20220925150248.2524421-1-sjg@chromium.org> References: <20220925150248.2524421-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.6 at phobos.denx.de X-Virus-Status: Clean At present we put the driver in the /chosen node in U-Boot. This is a bit strange, since U-Boot doesn't normally use that node itself. It is better to put it under the bootstd node. To make this work we need to copy the node to appear under /chosen when fixing up the device tree. Copy over all the properties too, so that fwupd knows what to do. Update the sandbox device tree accordingly. Signed-off-by: Simon Glass --- arch/sandbox/dts/test.dts | 29 ++++++++++++++--------------- boot/vbe_simple_os.c | 26 ++++++++++++++++++-------- test/boot/vbe_simple.c | 7 ++++++- 3 files changed, 38 insertions(+), 24 deletions(-) diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index 66391f7135b..bc7e95d2705 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -78,6 +78,7 @@ }; bootstd { + u-boot,dm-vpl; compatible = "u-boot,boot-std"; filename-prefixes = "/", "/boot/"; @@ -90,6 +91,19 @@ efi { compatible = "u-boot,distro-efi"; }; + + firmware0 { + u-boot,dm-vpl; + compatible = "fwupd,vbe-simple"; + storage = "mmc1"; + skip-offset = <0x200>; + area-start = <0x400>; + area-size = <0x1000>; + state-offset = <0x400>; + state-size = <0x40>; + version-offset = <0x800>; + version-size = <0x100>; + }; }; fuzzing-engine { @@ -1392,21 +1406,6 @@ compatible = "denx,u-boot-fdt-test"; reg = <9 1>; }; - - fwupd { - compatible = "simple-bus"; - firmware0 { - compatible = "fwupd,vbe-simple"; - storage = "mmc1"; - area-start = <0x400>; - area-size = <0x1000>; - skip-offset = <0x200>; - state-offset = <0x400>; - state-size = <0x40>; - version-offset = <0x800>; - version-size = <0x100>; - }; - }; }; translation-test@8000 { diff --git a/boot/vbe_simple_os.c b/boot/vbe_simple_os.c index 87778bba97e..b2041a95a30 100644 --- a/boot/vbe_simple_os.c +++ b/boot/vbe_simple_os.c @@ -62,24 +62,34 @@ static int bootmeth_vbe_simple_ft_fixup(void *ctx, struct event *event) */ for (vbe_find_first_device(&dev); dev; vbe_find_next_device(&dev)) { struct simple_state state; - ofnode node, subnode; + ofnode node, subnode, chosen; int ret; if (strcmp("vbe_simple", dev->driver->name)) continue; - /* Check if there is a node to fix up */ - node = oftree_path(tree, "/chosen/fwupd"); - if (!ofnode_valid(node)) - continue; - subnode = ofnode_find_subnode(node, dev->name); - if (!ofnode_valid(subnode)) + /* Check if there is a node to fix up, adding if not */ + chosen = oftree_path(tree, "/chosen"); + if (!ofnode_valid(chosen)) continue; + ret = ofnode_add_subnode(chosen, "fwupd", &node); + if (ret && ret != -EEXIST) + return log_msg_ret("fwu", ret); + + ret = ofnode_add_subnode(node, dev->name, &subnode); + if (ret && ret != -EEXIST) + return log_msg_ret("dev", ret); - log_debug("Fixing up: %s\n", dev->name); ret = device_probe(dev); if (ret) return log_msg_ret("probe", ret); + + /* Copy over the vbe properties for fwupd */ + log_debug("Fixing up: %s\n", dev->name); + ret = ofnode_copy_props(dev_ofnode(dev), subnode); + if (ret) + return log_msg_ret("cp", ret); + ret = vbe_simple_read_state(dev, &state); if (ret) return log_msg_ret("read", ret); diff --git a/test/boot/vbe_simple.c b/test/boot/vbe_simple.c index a50785dbbf6..5e61840652c 100644 --- a/test/boot/vbe_simple.c +++ b/test/boot/vbe_simple.c @@ -16,7 +16,12 @@ #include #include "bootstd_common.h" -/* Basic test of reading nvdata and updating a fwupd node in the device tree */ +/* + * Basic test of reading nvdata and updating a fwupd node in the device tree + * + * This sets up its own VBE info in the device, using bootstd_setup_for_tests() + * then does a VBE fixup and checks that everything is present. + */ static int vbe_simple_test_base(struct unit_test_state *uts) { const char *version, *bl_version; -- 2.37.3.998.g577e59143f-goog