From patchwork Sun Dec 8 00:17:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1205575 X-Patchwork-Delegate: xypron.glpk@gmx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="Yy4622jV"; 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 47Vn3Y5bc4z9sRH for ; Sun, 8 Dec 2019 11:18:17 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3C9A6808E5; Sun, 8 Dec 2019 01:17:59 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="Yy4622jV"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 071E481634; Sun, 8 Dec 2019 01:17:55 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 33E7580928 for ; Sun, 8 Dec 2019 01:17:51 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1575764268; bh=gqRaEsxZO+9rR4KQrjO1tWwIucUL2AuQ0bqJ8sZNZA8=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=Yy4622jVw1zD2SliGZLfHh0m+N75gYPfW2ObasfWyxWYweHYN13GSLGy6A7YnLiqt nGxadKSRM3nRAJbOr/1BGBsK/4oNcXoXs9U8hyXUMtjuUuk9OLnO87NeOkCjvk8IxC fSdHokga3ldqaWFOs7D4Hcweh6/8rVOH23azGbxY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([94.114.42.168]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MaJ7v-1iGuM51ztt-00WBnJ; Sun, 08 Dec 2019 01:17:48 +0100 From: Heinrich Schuchardt To: Alexander Graf Subject: [PATCH v2 2/4] efi_loader: use hardware device tree by default Date: Sun, 8 Dec 2019 01:17:40 +0100 Message-Id: <20191208001742.60076-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191208001742.60076-1-xypron.glpk@gmx.de> References: <20191208001742.60076-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:cT17jysKeravBc5yhp4SIZZsfLxZd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a/yet+gjI0dneJ3w4DmE26l4PYmEHGi+wEXpGpu23 ZtVJA4GfpjRO6r9vCCO+Nhq5N/gINB3v8+9WZdQWudf3mkvvjMURKbyglce/YQheOlIPXGM1W mc/RE27a4UcOwvGhQBHtHEFKwYDEpSlBNwouNfa7q1dJ/xjmsqU4ZgQUFyVkK0M7mHJMb2fuc 0YMp1mtFJQQgIIfMH0L9x6bSreTB5n4MvEh1Xgbl+LCMW6DbFFnru4AsjMDuK4IKX0T9fq+oe 9S0rCSDpUX0GI39pqFUJ4NnrB2MeXG6qoFfZCCuFHxUDahwWDzvMhz1nxKwAbzTs/aig0M8RO dCsKyQh0T/2gyi2ojhqKbWKayfArr2DtyyCStrKDBeaYkqcM2N71MZw2qMCKn9eWshAYV78Hv Jw6+QlCif7c7DOA2E6mFEXyjOE/qO+r7TMkacsgTNtcB9d1mtZrIo7amLaTk= X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: u-boot@lists.denx.de, Heinrich Schuchardt , Cristian Ciocaltea Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean If the bootefi command is called without passing the address of a device tree, the internal device tree is used. For devices with a hardware device tree it is preferable to used the hardware device tree in this case. Signed-off-by: Heinrich Schuchardt --- cmd/bootefi.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) -- 2.24.0 diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 2b190a3edd..a3e2a05126 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -200,14 +200,16 @@ static void *get_config_table(const efi_guid_t *guid) * * If fdt_addr is available, the device tree located at that memory address will * will be installed as configuration table, otherwise the device tree located - * at the address indicated by environment variable fdtcontroladdr will be used. + * at the address indicated by environment variable fdt_addr or as fallback + * fdtcontroladdr will be used. * * On architectures using ACPI tables device trees shall not be installed as * configuration table. * * @fdt_addr: address of device tree or EFI_FDT_USE_INTERNAL to use the - * internal device tree as indicated by environment variable - * fdtcontroladdr + * the hardware device tree as indicated by environment variable + * fdt_addr or as fallback the internal device tree as indicated by + * the environment variable fdtcontroladdr * Return: status code */ static efi_status_t efi_install_fdt(uintptr_t fdt_addr) @@ -232,15 +234,19 @@ static efi_status_t efi_install_fdt(uintptr_t fdt_addr) /* Look for device tree that is already installed */ if (get_config_table(&efi_guid_fdt)) return EFI_SUCCESS; - /* Use our own device tree as default */ - fdt_opt = env_get("fdtcontroladdr"); + /* Check if there is a hardware device tree */ + fdt_opt = env_get("fdt_addr"); + /* Use our own device tree as fallback */ if (!fdt_opt) { - printf("ERROR: need device tree\n"); - return EFI_NOT_FOUND; + fdt_opt = env_get("fdtcontroladdr"); + if (!fdt_opt) { + printf("ERROR: need device tree\n"); + return EFI_NOT_FOUND; + } } fdt_addr = simple_strtoul(fdt_opt, NULL, 16); if (!fdt_addr) { - printf("ERROR: invalid $fdtcontroladdr\n"); + printf("ERROR: invalid $fdt_addr or $fdtcontroladdr\n"); return EFI_LOAD_ERROR; } }