From patchwork Wed May 16 15:42:18 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914706 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Xap3ghXh"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJk00wwQz9s33 for ; Thu, 17 May 2018 01:48:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CA41BC21FC0; Wed, 16 May 2018 15:46:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CCA22C21F47; Wed, 16 May 2018 15:43:52 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 70C77C21F95; Wed, 16 May 2018 15:42:57 +0000 (UTC) Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by lists.denx.de (Postfix) with ESMTPS id 16C82C21FD1 for ; Wed, 16 May 2018 15:42:47 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id j186-v6so3072268ita.5 for ; Wed, 16 May 2018 08:42:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z4tbC/ZttgsaQtYaDPYHcsq/uoHXxybDvkSeluJbvgE=; b=Xap3ghXhLHKuAnxfj0i7YKkeLp432aE1bN7xR6cG9uZqiQ6EcSrtKnLUMiMhucLNEn zNpmqxrZWaL0G0B3/rfdiuydJv9hPuyJxgz/4wqiLiKekfr+Ic6mI/RYdWh/mV1ku5kE tIX5H5gVOW0IdhqEz/HSWfeu0o1JmibRCWWdCaVgOVhAF/TdrQwZhSMa/N8awKaty0E7 obqatgtNYlDuYNxX9l+wFlOe/vQRNaOIWJt2hL97v2cexS+g/4lOi/eT+fkVwMSEBf6N 2DC2ALP6pEgcTkWyANaNFiOEiPm9RDn07kd2yXb2+5GcexIWcVx3JgNtRnW07p5wiokU 6r3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Z4tbC/ZttgsaQtYaDPYHcsq/uoHXxybDvkSeluJbvgE=; b=mv3fXXhCdHwqu24HsiILRX2BLiy76W3Lvjde78IPpmpFsiVJ2w0tMR25Rl8wsR5fNV gdkI1gbqtc4omd8N1O4CFPcBpzfajCEdMy0iT8zMD83B8ZjCjUxQJgXeXOm9+Aaa8yyr iFFgR0wWJp3WuDcEkZNpY78pSjofBcaOIF2oLA0Gv7Yq716qp7n6fos9BpdwCawp4e9l +Qh0MGN4kNSita7rTHnrg8CVmiiXwSofCGN3fFt1lvE0XNpZNMOYsKC8lgq79ueAX9Ar dmnygPSnn/Zc5D9/5na1N/Mb+VAAZeJQ4znGsL8/Qk2ZymwJwzf6gZ0vayUxdBok1DEr Gujg== X-Gm-Message-State: ALKqPwetYEmYlLo2Vk2Pskzldw+khogXx+8PlUO50sIFrcGCIl2cRpct Iwl8AHF5BmqrmD+hI+5uyUMnFA== X-Google-Smtp-Source: AB8JxZokUAB0FceeS5SbLRVZcUTyqYg54ZlJi5h1QC7Te7FYyKFJiTJ6s+4L3Vs0s6IU6tAm1pRc4A== X-Received: by 2002:a24:ca87:: with SMTP id k129-v6mr1525699itg.140.1526485365681; Wed, 16 May 2018 08:42:45 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id n89-v6sm2690832ioo.45.2018.05.16.08.42.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:45 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 52CC2140474; Wed, 16 May 2018 09:42:44 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:18 -0600 Message-Id: <20180516154233.21457-2-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 01/16] efi: Init the 'rows' and 'cols' variables X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The current code causes a compiler error on gcc 4.8.4 as used by sandbox on Ubuntu 14.04, which is fairly recent. Init these variables to fix the problem. Signed-off-by: Simon Glass --- Changes in v4: - Move the fix to query_console_serial() Changes in v3: - Add new patch to init the 'rows' and 'cols' variables Changes in v2: None lib/efi_loader/efi_console.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index d777db8a3ed..001f68df0a7 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -185,8 +185,11 @@ static int query_console_serial(int *rows, int *cols) return -1; /* Read {depth,rows,cols} */ - if (term_read_reply(n, 3, 't')) + if (term_read_reply(n, 3, 't')) { + *rows = -1; + *cols = -1; return -1; + } *cols = n[2]; *rows = n[1]; From patchwork Wed May 16 15:42:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914723 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="bNgEORFW"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJs41qnYz9s2R for ; Thu, 17 May 2018 01:54:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id E6676C21FF5; Wed, 16 May 2018 15:53:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 29861C21FFD; Wed, 16 May 2018 15:45:01 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3BDECC22016; Wed, 16 May 2018 15:42:57 +0000 (UTC) Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by lists.denx.de (Postfix) with ESMTPS id B66B3C21FA3 for ; Wed, 16 May 2018 15:42:48 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id q72-v6so3137558itc.0 for ; Wed, 16 May 2018 08:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=cHwRRus5BnCVHhCbRHvQWLVAhkTh+TBlvlhDaGARFqE=; b=bNgEORFWJdSTWND51olZ5YUkZvydljlneXLVkYknuUfwDsls0VQgzTor2r/xYL1i6O Xq+Lx7FEYR8uC807sJR6Gui+Ja2LwhUc2Zk7r7WBvi91d7Arct4J1LDP8WmnuSZ2nGiM IxsSqeSRohz9uUi6RxTgN7KAyHMvhry+k4wiQ8u2n6jZVLo8rw4WKW7HgmbvxPcFwQxl x2XyYcRVSnwIULPjtPDEHloT/OdLULoHfoxYUCcD43e2ChSuUqIQ4vxzs4SU0RxXaaHv Js8oZOjQWAxRAdZNqoPULxB/lJMU+hQdx8JDQoKtsUl7AYHndyWghWG5Jhlw1OaqUxvD fwNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=cHwRRus5BnCVHhCbRHvQWLVAhkTh+TBlvlhDaGARFqE=; b=YmfOf623ydpf+U3hDL5Zr5M/oZERqJo3O8r1QLSnoUT4RUOxG2cRO1zrM6GxWkkc2f izTQ3AeULEIyxx3AwmYdxRReIBJblKuxj5yJgjGwkCkfpUy+BBZovBw9+Ein4W566L9K aSFTS9SInQ8b6UbY8uTNnx7gVK9/H38+sCJwV22tYFXnguCDLWoWsonbSekZbZPxNpjW uLm4Hx/0lRS9eaQbkdWV09CSaCZuHTxl9hQOF7JuUPpdBKWEF/RIeQcsJyLbqS2SDuQ6 LF5ZcJDf7EXWfw8gRgyBRVDTw0bj/BuNwf+QOPSh99cVEYijHuGFyjIUzeig1P0U94/c rdlw== X-Gm-Message-State: ALKqPwd2tqQDzk9NuD/8PdVgW35Qdkre4anlvuYKAj5tWeoqUA0LgrIN MQxSAVTdwbP5sMBmK1hD1ksmNQ== X-Google-Smtp-Source: AB8JxZr5AmfjCL6zoxnEX45rrlIUryH/OXDtt8S89cOzmJdepNEYmH1rRmSfC2lCztBPHmFBLhi3vg== X-Received: by 2002:a6b:f27:: with SMTP id x39-v6mr1756485ioi.91.1526485367139; Wed, 16 May 2018 08:42:47 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id v18-v6sm1767905ita.19.2018.05.16.08.42.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:46 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 83D40140208; Wed, 16 May 2018 09:42:45 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:19 -0600 Message-Id: <20180516154233.21457-3-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 02/16] efi: Update some comments related to smbios tables X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Clarify the operation of this code with some additional comments. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- Changes in v4: - Remove code already applied - Update subject Changes in v3: - Add comments on aligment - Return error value of efi_allocate_pages() - Update function comment for write_smbios_table() Changes in v2: - Update return type of efi_smbios_register() to efi_status_t - Use return value of efi_install_configuration_table include/efi_loader.h | 7 +++++++ include/smbios.h | 5 +++-- lib/efi_loader/efi_smbios.c | 7 ++++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 2868ca25abb..2519a7c33a7 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -207,6 +207,13 @@ efi_status_t efi_net_register(void); /* Called by bootefi to make the watchdog available */ efi_status_t efi_watchdog_register(void); /* Called by bootefi to make SMBIOS tables available */ +/** + * efi_smbios_register() - write out SMBIOS tables + * + * Called by bootefi to make SMBIOS tables available + * + * @return 0 if OK, -ENOMEM if no memory is available for the tables + */ efi_status_t efi_smbios_register(void); struct efi_simple_file_system_protocol * diff --git a/include/smbios.h b/include/smbios.h index 79880ef5b5c..97b9ddce237 100644 --- a/include/smbios.h +++ b/include/smbios.h @@ -231,8 +231,9 @@ typedef int (*smbios_write_type)(ulong *addr, int handle); * * This writes SMBIOS table at a given address. * - * @addr: start address to write SMBIOS table - * @return: end address of SMBIOS table + * @addr: start address to write SMBIOS table. If this is not + * 16-byte-aligned then it will be aligned before the table is written + * @return: end address of SMBIOS table (and start address for next entry) */ ulong write_smbios_table(ulong addr); diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 482436e2adb..7c3fc8af0b2 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -29,7 +29,12 @@ efi_status_t efi_smbios_register(void) if (ret != EFI_SUCCESS) return ret; - /* Generate SMBIOS tables */ + /* + * Generate SMBIOS tables - we know that efi_allocate_pages() returns + * a 4k-aligned address, so it is safe to assume that + * write_smbios_table() will write the table at that address. + */ + assert(!(dmi & 0xf)); write_smbios_table(dmi); /* And expose them to our EFI payload */ From patchwork Wed May 16 15:42:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914710 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="M17GMzw5"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJmm4Y63z9s2R for ; Thu, 17 May 2018 01:50:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 43676C21FBB; Wed, 16 May 2018 15:47:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 44EE9C21FCC; Wed, 16 May 2018 15:44:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 049B9C21FE3; Wed, 16 May 2018 15:42:59 +0000 (UTC) Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by lists.denx.de (Postfix) with ESMTPS id 9CE7CC21FE1 for ; Wed, 16 May 2018 15:42:49 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id j186-v6so3072663ita.5 for ; Wed, 16 May 2018 08:42:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4BfyYUecsE/68U1gSIPLLTBBBu9LrdUhfKliZKL0zik=; b=M17GMzw5fDGue5TO0ofaUseFyQFKB8a8IDkf2bfdGoaXJVgQ6TChwJj7mN3uqNwgfF Z6mhbGCekL4fcrPipguRwbLzFFWfqE1aGh9Tfsa/i/9Bpjq3Uiek9HJiVh0gvjmAO8uC emAryPk0C2SCX2n3+k/jzSpqGgxx1OZWWt91bc4AeV3MPHPS2Wa7IThKKExCGj2gpu6y yn0ZKcNgkEJaG7AKb8jLUAznZ6eKKKTCIH4V5hDJ3huDe3n+HLaLnCw80p7xb6F5sRwh oxD1e8mPelyDT+TJ0tvi/HEsUuTvn+QHOTJktTo1fF/8pbSVEyVgcQ9wPSFPJNYjK9S2 dJig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4BfyYUecsE/68U1gSIPLLTBBBu9LrdUhfKliZKL0zik=; b=S++oit2XyPJbNYKVt+Ivd+1kJliHVqaVqR07tBZUqHfBjeE2NVi6grlQdjDWpUx6Qf CTmnJ1vWiYKz9D9vjrtmf3Srnxls0U7k5wNQvGX1P/bT1QEqaCgw7ciEeJyvIbxxmjPb 1K7sRqHGJc/6WJC/uyHlvmRuEA7uOTxXR59FNcT34dfj2wqaJ/1PkIH4+pwxCeES69cB ppviWolf/IZA9CeNVVbIc9BUJhmOCNM9vuvFzXy7dVnY+5RKVjSztlsdXgzRP9bkPD91 MaVy6ajeQ5+deKckHLgRC7lWIsk9Mu94PmwEJkglol4HRASmwEnh1er9g3Tv483DpcQ+ jwpQ== X-Gm-Message-State: ALKqPwcGpHBazlWVMrq3tkg/qiIxXK6EuoFkVB6a299kt7vetFmriEd3 nDO9itWfNUQuOKP5ItKT6dNrEA== X-Google-Smtp-Source: AB8JxZqlljMDUzf0udWB8E0xAqcRJuZSNjONC/Zxnd83Z9y0IdLcvJY3AbzCLb/GHzkguDNmOrVnbg== X-Received: by 2002:a24:8b82:: with SMTP id g124-v6mr1462999ite.56.1526485368116; Wed, 16 May 2018 08:42:48 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id j200-v6sm1782961itj.9.2018.05.16.08.42.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:47 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id D98B2140474; Wed, 16 May 2018 09:42:46 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:20 -0600 Message-Id: <20180516154233.21457-4-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 03/16] efi: sandbox: Adjust memory usage for sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With sandbox the U-Boot code is not mapped into the sandbox memory range so does not need to be excluded when allocating EFI memory. Update the EFI memory init code to take account of that. Also use mapmem instead of a cast to convert a memory address to a pointer. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: - Update to use mapmem instead of a cast lib/efi_loader/efi_memory.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 664c651db56..3fbed63728b 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -388,7 +389,7 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) r = efi_allocate_pages(0, pool_type, num_pages, &t); if (r == EFI_SUCCESS) { - struct efi_pool_allocation *alloc = (void *)(uintptr_t)t; + struct efi_pool_allocation *alloc = map_sysmem(t, size); alloc->num_pages = num_pages; *buffer = alloc->data; } @@ -499,18 +500,22 @@ int efi_memory_init(void) efi_add_known_memory(); - /* Add U-Boot */ - uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK; - uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; - efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, false); - - /* Add Runtime Services */ - runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; - runtime_end = (ulong)&__efi_runtime_stop; - runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; - runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; - efi_add_memory_map(runtime_start, runtime_pages, - EFI_RUNTIME_SERVICES_CODE, false); + if (!IS_ENABLED(CONFIG_SANDBOX)) { + /* Add U-Boot */ + uboot_start = (gd->start_addr_sp - uboot_stack_size) & + ~EFI_PAGE_MASK; + uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; + efi_add_memory_map(uboot_start, uboot_pages, EFI_LOADER_DATA, + false); + + /* Add Runtime Services */ + runtime_start = (ulong)&__efi_runtime_start & ~EFI_PAGE_MASK; + runtime_end = (ulong)&__efi_runtime_stop; + runtime_end = (runtime_end + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; + runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; + efi_add_memory_map(runtime_start, runtime_pages, + EFI_RUNTIME_SERVICES_CODE, false); + } #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER /* Request a 32bit 64MB bounce buffer region */ From patchwork Wed May 16 15:42:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914708 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="tnLkMvlj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJlM0Fxnz9s33 for ; Thu, 17 May 2018 01:49:18 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 93EF2C21FBB; Wed, 16 May 2018 15:47:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id CA5ABC21F99; Wed, 16 May 2018 15:43:54 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2C8A1C21FC5; Wed, 16 May 2018 15:42:59 +0000 (UTC) Received: from mail-it0-f49.google.com (mail-it0-f49.google.com [209.85.214.49]) by lists.denx.de (Postfix) with ESMTPS id 552C6C21FCE for ; Wed, 16 May 2018 15:42:51 +0000 (UTC) Received: by mail-it0-f49.google.com with SMTP id p3-v6so3048906itc.0 for ; Wed, 16 May 2018 08:42:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=4TJvAoWcMrJZRy0EH1Y7cSIPAIawrncaDdvjXqOQUvo=; b=tnLkMvljY0s2aF9+5GE0QzYagXW9QC6IRYnZhB8HSulImAkxBgxicXCjSYpJifde5x HFCsxZbox+XPuLHQSb4YP/M62A0htJAERV70XLrYESBVOStTvq0MEfSKcAjoXb+TTusn Z9U0Rn6cr0kJPyVrnOYbTlS6ZyM0jGl4srGg2Fh1BpGsfzc7oXTggtkifLbtibJE4eV/ jATlRTlTDsPcj43R6FNNbR9eeuTglELJO/4IDYvIJQs1x9c4j8mW1ujQoHCOsX/Ht7l0 V1AjhheruuZn7pDSWNJMS9AnTTOgUL7p42gHYdHhb8yETPdR3ThyJztKwLIgamV268RL iXZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=4TJvAoWcMrJZRy0EH1Y7cSIPAIawrncaDdvjXqOQUvo=; b=EpNS23mqDgjz8FIx6p0hRBBsc9WceBQgt8MfjGYkLhOEeAGO3SwAr2OaWqxhO5Y873 M7cLx52AScIiW3ltfRy1d/hUr08fU1ilmZIXfU4jxCo5wiE5qvDQkpB9ZlGfMc8m8s0X BnlAV4z+nD5QZHiVVMGTroPkuXg8+gPD+tur/DPdSDbTt8Yi7TDfN6Fz+v4XWTICFFaD e+aVrfYVW6kNfauHxdLlC1VZyUPJu+dOD5RmCLIGHbtozw3rxBCSKJqKZmlVcNOvQy4x tyGTmi7RUYjoUN1Jc5ZLCOZtXH3Cp625ZhSCHyqxan8clzERWi6GzxN2a67Ei6Pwi+al oA+w== X-Gm-Message-State: ALKqPwdsiCevoogwvkS1pMxMNwWVpaGF3FxGp7IKqhdeaYXraeFQTw/d lERS//4QG7E3BiKNO0GwkofcWg== X-Google-Smtp-Source: AB8JxZqO2WosPQA6Ne7ll7COxBBTlYIk1ASgDLZuWyRgoFRyBrdaRrt5j+cvbghyX5RA27G42aV+eg== X-Received: by 2002:a6b:c7c4:: with SMTP id x187-v6mr1617581iof.227.1526485369805; Wed, 16 May 2018 08:42:49 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id f4-v6sm1797092itf.22.2018.05.16.08.42.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:49 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 5C9A3140208; Wed, 16 May 2018 09:42:48 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:21 -0600 Message-Id: <20180516154233.21457-5-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 04/16] sandbox: smbios: Update to support sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" At present this code casts addresses to pointers so cannot be used with sandbox. Update it to use mapmem instead. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: - Drop incorrect map_sysmem() in write_smbios_table() Changes in v2: None lib/smbios.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/lib/smbios.c b/lib/smbios.c index df3d26b0710..fc3dabcbc1b 100644 --- a/lib/smbios.c +++ b/lib/smbios.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include @@ -72,9 +73,10 @@ static int smbios_string_table_len(char *start) static int smbios_write_type0(ulong *current, int handle) { - struct smbios_type0 *t = (struct smbios_type0 *)*current; + struct smbios_type0 *t; int len = sizeof(struct smbios_type0); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type0)); fill_smbios_header(t, SMBIOS_BIOS_INFORMATION, len, handle); t->vendor = smbios_add_string(t->eos, "U-Boot"); @@ -101,16 +103,18 @@ static int smbios_write_type0(ulong *current, int handle) len = t->length + smbios_string_table_len(t->eos); *current += len; + unmap_sysmem(t); return len; } static int smbios_write_type1(ulong *current, int handle) { - struct smbios_type1 *t = (struct smbios_type1 *)*current; + struct smbios_type1 *t; int len = sizeof(struct smbios_type1); char *serial_str = env_get("serial#"); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type1)); fill_smbios_header(t, SMBIOS_SYSTEM_INFORMATION, len, handle); t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER); @@ -122,15 +126,17 @@ static int smbios_write_type1(ulong *current, int handle) len = t->length + smbios_string_table_len(t->eos); *current += len; + unmap_sysmem(t); return len; } static int smbios_write_type2(ulong *current, int handle) { - struct smbios_type2 *t = (struct smbios_type2 *)*current; + struct smbios_type2 *t; int len = sizeof(struct smbios_type2); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type2)); fill_smbios_header(t, SMBIOS_BOARD_INFORMATION, len, handle); t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER); @@ -140,15 +146,17 @@ static int smbios_write_type2(ulong *current, int handle) len = t->length + smbios_string_table_len(t->eos); *current += len; + unmap_sysmem(t); return len; } static int smbios_write_type3(ulong *current, int handle) { - struct smbios_type3 *t = (struct smbios_type3 *)*current; + struct smbios_type3 *t; int len = sizeof(struct smbios_type3); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type3)); fill_smbios_header(t, SMBIOS_SYSTEM_ENCLOSURE, len, handle); t->manufacturer = smbios_add_string(t->eos, CONFIG_SMBIOS_MANUFACTURER); @@ -160,6 +168,7 @@ static int smbios_write_type3(ulong *current, int handle) len = t->length + smbios_string_table_len(t->eos); *current += len; + unmap_sysmem(t); return len; } @@ -198,9 +207,10 @@ static void smbios_write_type4_dm(struct smbios_type4 *t) static int smbios_write_type4(ulong *current, int handle) { - struct smbios_type4 *t = (struct smbios_type4 *)*current; + struct smbios_type4 *t; int len = sizeof(struct smbios_type4); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type4)); fill_smbios_header(t, SMBIOS_PROCESSOR_INFORMATION, len, handle); t->processor_type = SMBIOS_PROCESSOR_TYPE_CENTRAL; @@ -214,32 +224,37 @@ static int smbios_write_type4(ulong *current, int handle) len = t->length + smbios_string_table_len(t->eos); *current += len; + unmap_sysmem(t); return len; } static int smbios_write_type32(ulong *current, int handle) { - struct smbios_type32 *t = (struct smbios_type32 *)*current; + struct smbios_type32 *t; int len = sizeof(struct smbios_type32); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type32)); fill_smbios_header(t, SMBIOS_SYSTEM_BOOT_INFORMATION, len, handle); *current += len; + unmap_sysmem(t); return len; } static int smbios_write_type127(ulong *current, int handle) { - struct smbios_type127 *t = (struct smbios_type127 *)*current; + struct smbios_type127 *t; int len = sizeof(struct smbios_type127); + t = map_sysmem(*current, len); memset(t, 0, sizeof(struct smbios_type127)); fill_smbios_header(t, SMBIOS_END_OF_TABLE, len, handle); *current += len; + unmap_sysmem(t); return len; } @@ -268,7 +283,7 @@ ulong write_smbios_table(ulong addr) /* 16 byte align the table address */ addr = ALIGN(addr, 16); - se = (struct smbios_entry *)(uintptr_t)addr; + se = map_sysmem(addr, sizeof(struct smbios_entry)); memset(se, 0, sizeof(struct smbios_entry)); addr += sizeof(struct smbios_entry); @@ -297,6 +312,7 @@ ulong write_smbios_table(ulong addr) isize = sizeof(struct smbios_entry) - SMBIOS_INTERMEDIATE_OFFSET; se->intermediate_checksum = table_compute_checksum(istart, isize); se->checksum = table_compute_checksum(se, sizeof(struct smbios_entry)); + unmap_sysmem(se); return addr; } From patchwork Wed May 16 15:42:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914711 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="qkgD++GX"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJmp5kJxz9s2R for ; Thu, 17 May 2018 01:50:34 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 6E454C21FD5; Wed, 16 May 2018 15:48:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 625F9C21FEA; Wed, 16 May 2018 15:44:15 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B9FA9C21FEC; Wed, 16 May 2018 15:43:04 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id 63C39C21F9A for ; Wed, 16 May 2018 15:42:53 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id j186-v6so3073211ita.5 for ; Wed, 16 May 2018 08:42:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Qfkn/mnZ/iPeqwWrRwbMntsIvRIqiCW1KW5T+cjQz+c=; b=qkgD++GXekV3LybsLD3iHXlhYBG6Oj7u+vpRDrqnfDpdM2Eiq1M70YKBDvQ+8kC7XZ T0sj8Y38NyILb3Z16f15A6IwFKBPxULAvRvSeFtRiG7yxEBDCS7lyy62ZrPCT/EEJOzU U1DRH9n8mARYEjrFL9VCT1S5syFIaPnzGJu1FX+KUbEGdgeR7NMK2ZLRasR+7daHzMj3 mx+CEPksO99snbHEfi+eyL++51UuPQYfVnZryWakvLYfTpA0Up229+3fl1xzPloEYIob JqekzPNTCXchOpQVTEjX4jZeiyZan7weAc3mpPPubu8GUUH5Hl5hD8M1emGthOPDfz+N w3eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Qfkn/mnZ/iPeqwWrRwbMntsIvRIqiCW1KW5T+cjQz+c=; b=MXrGkUwu2A1jJ/CjbKalEe/QH9RYWgkp4Az+aYFt4Zkog1yyZ7iBj+lwlOfPQxMnWj JtEH74k1JRHAdZqtBsM/QItIatwPDkOwBtCbd0ppBf1YsdnBbH3d+1k/DUWQxznnd/J+ x/1t+B8oWOAMT4GVGvuCG4RPpl5I1QphNEAuEMVpZ0h4OchDEK3+7xPDoMDOWVKA7L6v 5bOTxSZO0S9eto6zXV8t0Vthin3SCm/qLcTVge6uYDStYOh4uOo6yisagig9P++1fFcf TcXWhzt+LDsTEfMY4Ph8cMm87Rwnj5vmYciTQ8mbAZzM5W2EXlVqIlYpHZ2dyH8WRBN6 fQbA== X-Gm-Message-State: ALKqPwfpGGxNuTi1Q28qMSAqtD0oxCR5okGe9MeU3Zon1WJpDffr653/ gja7Vbp6Hqqtm62HaoLPlQfPLQ== X-Google-Smtp-Source: AB8JxZp5K7c/q9n2iG+mRKhpiRorT2YU0vSDfjOm68A1sLl52jNccAFeClpJSp/HB1fpDQyPD/FanA== X-Received: by 2002:a24:e9c1:: with SMTP id f184-v6mr1508681ith.79.1526485371883; Wed, 16 May 2018 08:42:51 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id r23-v6sm1660162ioe.9.2018.05.16.08.42.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:50 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id DFC14140208; Wed, 16 May 2018 09:42:49 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:22 -0600 Message-Id: <20180516154233.21457-6-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 05/16] sandbox: Add a setjmp() implementation X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add an implementation of setjmp() and longjmp() which rely on the underlying host C library. Since we cannot know how large the jump buffer needs to be, pick something that should be suitable and check it at runtime. At present we need access to the underlying struct as well. Signed-off-by: Simon Glass --- Changes in v4: - Fix up the sizeof() operations on jmp_buf - Update SPDX tags Changes in v3: None Changes in v2: None arch/sandbox/cpu/cpu.c | 13 +++++++++++++ arch/sandbox/cpu/os.c | 23 +++++++++++++++++++++++ arch/sandbox/include/asm/setjmp.h | 30 ++++++++++++++++++++++++++++++ include/os.h | 21 +++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 arch/sandbox/include/asm/setjmp.h diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index d4ad020012e..cde0b055a67 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -164,3 +165,15 @@ ulong timer_get_boot_us(void) return (count - base_count) / 1000; } + +int setjmp(jmp_buf jmp) +{ + return os_setjmp((ulong *)jmp, sizeof(*jmp)); +} + +void longjmp(jmp_buf jmp, int ret) +{ + os_longjmp((ulong *)jmp, ret); + while (1) + ; +} diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index d76d0211a2d..5839932b005 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -628,3 +629,25 @@ void os_localtime(struct rtc_time *rt) rt->tm_yday = tm->tm_yday; rt->tm_isdst = tm->tm_isdst; } + +int os_setjmp(ulong *jmp, int size) +{ + jmp_buf dummy; + + /* + * We cannot rely on the struct name that jmp_buf uses, so use a + * local variable here + */ + if (size < sizeof(dummy)) { + printf("setjmp: jmpbuf is too small (%d bytes, need %d)\n", + size, sizeof(jmp_buf)); + return -ENOSPC; + } + + return setjmp((struct __jmp_buf_tag *)jmp); +} + +void os_longjmp(ulong *jmp, int ret) +{ + longjmp((struct __jmp_buf_tag *)jmp, ret); +} diff --git a/arch/sandbox/include/asm/setjmp.h b/arch/sandbox/include/asm/setjmp.h new file mode 100644 index 00000000000..0fb1a11f234 --- /dev/null +++ b/arch/sandbox/include/asm/setjmp.h @@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * (C) 2018 Google, Inc + * Written by Simon Glass + */ + +#ifndef _SETJMP_H_ +#define _SETJMP_H_ + +struct jmp_buf_data { + /* + * We're not sure how long this should be: + * + * amd64: 200 bytes + * arm64: 392 bytes + * armhf: 392 bytes + * + * So allow space for all of those, plus some extra. + * We don't need to worry about 16-byte alignment, since this does not + * run on Windows. + */ + ulong data[128]; +}; + +typedef struct jmp_buf_data jmp_buf[1]; + +int setjmp(jmp_buf jmp); +__noreturn void longjmp(jmp_buf jmp, int ret); + +#endif /* _SETJMP_H_ */ diff --git a/include/os.h b/include/os.h index 64e89a06c94..c8e0f52d306 100644 --- a/include/os.h +++ b/include/os.h @@ -330,4 +330,25 @@ int os_spl_to_uboot(const char *fname); */ void os_localtime(struct rtc_time *rt); +/** + * os_setjmp() - Call setjmp() + * + * Call the host system's setjmp() function. + * + * @jmp: Buffer to store current execution state + * @size: Size of buffer + * @return normal setjmp() value if OK, -ENOSPC if @size is too small + */ +int os_setjmp(ulong *jmp, int size); + +/** + * os_longjmp() - Call longjmp() + * + * Call the host system's longjmp() function. + * + * @jmp: Buffer where previous execution state was stored + * @ret: Value to pass to longjmp() + */ +void os_longjmp(ulong *jmp, int ret); + #endif From patchwork Wed May 16 15:42:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914725 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="QCQK3slC"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJsv6xB0z9s3B for ; Thu, 17 May 2018 01:54:59 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9B2C2C21FCD; Wed, 16 May 2018 15:49:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 141E3C21FEB; Wed, 16 May 2018 15:44:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 65FD6C21FE2; Wed, 16 May 2018 15:43:04 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id 7152CC21FE5 for ; Wed, 16 May 2018 15:42:54 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id 144-v6so2972704iti.5 for ; Wed, 16 May 2018 08:42:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=UNxsbCM5VWVt7Z2fqmbIiuu5ZZ0+jo9sEATUa/G6cuk=; b=QCQK3slCbR6Mph5i2ByTGWm1Z6zktlZWddKKt6RYt6OoSq7nwH26wTinbrb0QvMYAb h6HpDpOfNS9JNfFIE3jEJC2h2ueSRbFiahPryTZYY0AZlFSKLtjwqKwFkQuZFI3p/lgB DGx7cprkkKXDeQWrnB4w7aiqWXefom2iTj8O5SDzFyzANvVH4MsMMOkStXOfAM1yN33Q g3OFc3308lEaXeAVnzHUn9iHZKoI2jL3lwOlclWhp1d9nkroOLDzVzAOpoP8B1EThkKa D5Eh7nHDl4OUBpLVWkrSQmUqkVwPi+BE/Sy1BqIq9cSCPACAQxLSPpOPNkt+K27kQgTY iUTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=UNxsbCM5VWVt7Z2fqmbIiuu5ZZ0+jo9sEATUa/G6cuk=; b=Dou6WybIcd6OzH/Rz170aIcQIB9CCHwtaW+6aAJbSJ8Ymo63cYgjP8AdAhFMNNfMt1 QMGrJoyzTD2L47nveQZKWisofe2/XR8+uJbXM6cUBstAAhWogvpWkZCUu3FVc8KuTnXA L2gYnQ4F96O5NQlSJ/bDFs9wUS9H+7v6oLKikAIrBhiKR3kMquf8oSAOz8aYul+aX8ad XHDxuo1INt3XKHQrJcC9lIy5ck1/tp2WfMcE0xAJWShVgr+txMAXXJtQu5M7VjiGxaF/ RUll2f0+i9yno51EqbXPRsqEQsD761+RhPm4I7QdDTGT+dSADC//c687nmoBjkzqk3t9 blFQ== X-Gm-Message-State: ALKqPwf+fRAWI3kwroUVNAiEbOUc+D6RqgWXX99jdRAS9aAAl7p72zJC vc5F6bZzPT5IimWtsbgcxWa+KQ== X-Google-Smtp-Source: AB8JxZpsc8pI3KsS7TG41ABAp+V+IrmT4RbcESsJRdomjyzu0L5VE7sSVo59R+6T4c22ULbVp+0rDA== X-Received: by 2002:a6b:10a0:: with SMTP id 32-v6mr1859309ioq.78.1526485373003; Wed, 16 May 2018 08:42:53 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id d16-v6sm1482246iob.74.2018.05.16.08.42.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:52 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 5AA08140474; Wed, 16 May 2018 09:42:51 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:23 -0600 Message-Id: <20180516154233.21457-7-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 06/16] efi: sandbox: Add required linker sections X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The EFI loader code requires certain linker sections to exist. Add these for sandbox so that the EFI loader code will link. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None arch/sandbox/cpu/u-boot.lds | 29 +++++++++++++++++++++++++++++ arch/sandbox/lib/Makefile | 2 +- arch/sandbox/lib/sections.c | 12 ++++++++++++ 3 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 arch/sandbox/lib/sections.c diff --git a/arch/sandbox/cpu/u-boot.lds b/arch/sandbox/cpu/u-boot.lds index f97abdfa050..3a6cf55eb99 100644 --- a/arch/sandbox/cpu/u-boot.lds +++ b/arch/sandbox/cpu/u-boot.lds @@ -18,6 +18,35 @@ SECTIONS __u_boot_sandbox_option_end = .; __bss_start = .; + + .__efi_runtime_start : { + *(.__efi_runtime_start) + } + + .efi_runtime : { + *(efi_runtime_text) + *(efi_runtime_data) + } + + .__efi_runtime_stop : { + *(.__efi_runtime_stop) + } + + .efi_runtime_rel_start : + { + *(.__efi_runtime_rel_start) + } + + .efi_runtime_rel : { + *(.relefi_runtime_text) + *(.relefi_runtime_data) + } + + .efi_runtime_rel_stop : + { + *(.__efi_runtime_rel_stop) + } + } INSERT BEFORE .data; diff --git a/arch/sandbox/lib/Makefile b/arch/sandbox/lib/Makefile index 52eef2e662e..b4ff717e784 100644 --- a/arch/sandbox/lib/Makefile +++ b/arch/sandbox/lib/Makefile @@ -5,7 +5,7 @@ # (C) Copyright 2002-2006 # Wolfgang Denk, DENX Software Engineering, wd@denx.de. -obj-y += interrupts.o +obj-y += interrupts.o sections.o obj-$(CONFIG_PCI) += pci_io.o obj-$(CONFIG_CMD_BOOTM) += bootm.o obj-$(CONFIG_CMD_BOOTZ) += bootm.o diff --git a/arch/sandbox/lib/sections.c b/arch/sandbox/lib/sections.c new file mode 100644 index 00000000000..697a8167ddf --- /dev/null +++ b/arch/sandbox/lib/sections.c @@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2013 Albert ARIBAUD + * + */ + +char __efi_runtime_start[0] __attribute__((section(".__efi_runtime_start"))); +char __efi_runtime_stop[0] __attribute__((section(".__efi_runtime_stop"))); +char __efi_runtime_rel_start[0] + __attribute__((section(".__efi_runtime_rel_start"))); +char __efi_runtime_rel_stop[0] + __attribute__((section(".__efi_runtime_rel_stop"))); From patchwork Wed May 16 15:42:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914727 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="qHmG5DOi"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJt52s2Mz9s33 for ; Thu, 17 May 2018 01:55:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 1C690C21FCD; Wed, 16 May 2018 15:49:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 3B6F4C21FFC; Wed, 16 May 2018 15:44:16 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5BB6DC21FDD; Wed, 16 May 2018 15:43:06 +0000 (UTC) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by lists.denx.de (Postfix) with ESMTPS id 84F3DC21F98 for ; Wed, 16 May 2018 15:42:55 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id c5-v6so1344035itj.1 for ; Wed, 16 May 2018 08:42:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ia55LDYGCiwGYV4i4pCrrinvXcoDkjCN6Djg9W2hwHk=; b=qHmG5DOiiIfT14GuS2Dcmt74nuuX6/iLUEFFFqK84yYXMORqlvK3jdzN6q9iPNIvOd Jx8iZsXaE718EqY5Pr1GK3bzZ32XfIXMbQeKReIArN1rJkPTb6JmwBkGRuyWpFQbC0tF u8N/y9ux5Ky4y/3Muw2om7SPqSuoDx0gvrXiXuN1ygqdnKi5emKxTZfHGktNJtT/6+zR iM6mwMTUkFp1yboiB42XvdXzaEOgY3xIldELTJ77PRhi13cmzRNjfDHmHMGmA1MLx9zg 2tltcwtHjn34siImp036KzuFbuAzq60e2MuAxdIvYYn5mi24qE3cSMa46O27Z+xzueBR TiwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ia55LDYGCiwGYV4i4pCrrinvXcoDkjCN6Djg9W2hwHk=; b=ossFsQcvgfr3HgGpo6lxRrkZRL/MtufL7lTMsKWkgxTWdcUMtwbjU+51IXcAvAf0N1 TPwpld1YhmWka6CEu0QNdaMz3tzddofPmYFXM3e5p3AOxqDw1kxvrhrmYfX8P6RIgL5Z 3xI0GpkD7luQO25klnhSnl7dCaTB2qPoAiW29fahd8FC+b0eVmHhpHRBSJemzJ9L3MMO kryezY2LGWXpamWc9qg7BSy1CYp4Nn0rtVRLDDRbeVKA1kgxE39/8ZNb6/Bevs/7+g+C bW4pnpCLG5Jx0gFYgZ98SAyWGNbo39Pa0PrA1AbQGgzMKuKQWenMIaZH9ddeEnK0EnED a2jg== X-Gm-Message-State: ALKqPwdkyL/aqN/SM/bDETMddByGVFIrn3wIilmhs+B/NYDDo/GD+zwF iqZyuMkYUvgwbAHo/JmaTpcnKQ== X-Google-Smtp-Source: AB8JxZopPVaJ6ylQf/ZpoYP8PQlKEfNwqVKB38X7hLjvzrzNjT+cd65gFrDNIXhUxngvMYE3nUJbEQ== X-Received: by 2002:a6b:a649:: with SMTP id p70-v6mr1785242ioe.33.1526485373768; Wed, 16 May 2018 08:42:53 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id k1-v6sm1600498iti.42.2018.05.16.08.42.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:53 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id C3FC7140208; Wed, 16 May 2018 09:42:52 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:24 -0600 Message-Id: <20180516154233.21457-8-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 07/16] efi: sandbox: Add distroboot support X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" With sandbox these values depend on the host system. Let's assume that it is x86_64 for now. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None include/config_distro_bootcmd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index 8d5feb3ac77..97d6baab4be 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -246,7 +246,7 @@ #elif defined(CONFIG_ARM) #define BOOTENV_EFI_PXE_ARCH "0xa" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000" -#elif defined(CONFIG_X86) +#elif defined(CONFIG_X86) || defined(CONFIG_SANDBOX) /* Always assume we're running 64bit */ #define BOOTENV_EFI_PXE_ARCH "0x7" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000" From patchwork Wed May 16 15:42:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914707 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="alZEZfjD"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJkD6t3lz9s33 for ; Thu, 17 May 2018 01:48:20 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 8D3ACC21FBA; Wed, 16 May 2018 15:45:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 01CF6C21FC0; Wed, 16 May 2018 15:43:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 375DDC21F9A; Wed, 16 May 2018 15:43:07 +0000 (UTC) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by lists.denx.de (Postfix) with ESMTPS id 73670C21FAC for ; Wed, 16 May 2018 15:42:57 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id q72-v6so3138985itc.0 for ; Wed, 16 May 2018 08:42:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=98gc/ByP4IMrSXdki/xlJTJmk2/lav2O+3qUE2ZzbyQ=; b=alZEZfjD6w4LxzEh4wUaKQWh5NXUsEyHi0CnbyKbMqj3EDNTEoeuH5AGZQRQk4GrEO YmGBiamyqU17dfu273bwXJwoasi/JgUsuLnHKRWdzwCi794keFEP5CYlJBpcQf67z+Bc T8y7aOYE2yJrfKOARCQqtZ4/3lfGj28qSnzbWBOFWbkHQnK1tZUxOHXvyK7SgcOw9ec6 vtantGAjRHnKnvc7jDsSvvGlRtm9+2yDzR3mxS27H9sRu5kXYuV/nCMCabFfdgoBB9pg jnaInVYwLx3fmXXOgAAGqQjr1dmwVQGdpVYKcgK+sPSWSocwZGoT8+OJZjIHKBwreuin 22cg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=98gc/ByP4IMrSXdki/xlJTJmk2/lav2O+3qUE2ZzbyQ=; b=IFyOrnr1mvAywbNv2BlebUyr23O54dVhbvpfiX4vM1qS1sDvPwT0y6MEUdxnEYooFe 9LiHPUJKrZqCoENklTYojYJPnYpzxgjPes4s2CuvkQBS5bhalel2UPE/289aC6+sOZGd tpw0iPmr6CkTJPfnvj5pUtlBh1Ets2qbTM8rEr0J8yi3dzHvEIQyBI79EiRosL6ausbz CkXkL81yPboj46B1a3O2yonLSnGG4R4cvnoe3mR4vm4jGbxubX0potHqPkwmD3N//imZ IR/GbXWFPME1SA2C1KrGcU+IGcjwQBPoZ8/Uhyx10nh1I6am8Hkj3E1QPMs/uPegELXh 8Nag== X-Gm-Message-State: ALKqPwdH/10SWONBA30mNLuUeIMpSZAdFE4yOfgBFFcPKjCcXSyqTGgV 4KE1xQPp0eXAgSGKbePffVuHVA== X-Google-Smtp-Source: AB8JxZq543WJdsHLetjQ2RdQVMgTW6XvDSqyWrMk3XdeEySSKaNRcguEe89W7Es/Ts2D/qSnLUfcnQ== X-Received: by 2002:a6b:c9d8:: with SMTP id z207-v6mr1704075iof.266.1526485375995; Wed, 16 May 2018 08:42:55 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id t123-v6sm1712715itb.20.2018.05.16.08.42.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:54 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 3F309140208; Wed, 16 May 2018 09:42:54 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:25 -0600 Message-Id: <20180516154233.21457-9-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 08/16] Define board_quiesce_devices() in a shared location X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This undocumented function relies on arch-specific code to declare a nop weak version. Add the weak function in common code instead to avoid having to duplicate the same function in each arch. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None arch/arm/include/asm/u-boot-arm.h | 1 - arch/x86/include/asm/u-boot-x86.h | 1 - arch/x86/lib/bootm.c | 4 ---- common/bootm.c | 4 ++++ include/bootm.h | 2 ++ 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm/include/asm/u-boot-arm.h b/arch/arm/include/asm/u-boot-arm.h index 01c3ba87c3f..cc828c45045 100644 --- a/arch/arm/include/asm/u-boot-arm.h +++ b/arch/arm/include/asm/u-boot-arm.h @@ -37,7 +37,6 @@ int arch_early_init_r(void); /* board/.../... */ int board_init(void); -void board_quiesce_devices(void); /* cpu/.../interrupt.c */ int arch_interrupt_init (void); diff --git a/arch/x86/include/asm/u-boot-x86.h b/arch/x86/include/asm/u-boot-x86.h index 9be45846a53..2340ef83323 100644 --- a/arch/x86/include/asm/u-boot-x86.h +++ b/arch/x86/include/asm/u-boot-x86.h @@ -84,7 +84,6 @@ static inline __attribute__((no_instrument_function)) uint64_t rdtsc(void) /* board/... */ void timer_set_tsc_base(uint64_t new_base); uint64_t timer_get_tsc(void); -void board_quiesce_devices(void); void quick_ram_check(void); diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c index 533ba075bb1..54c22fe6de3 100644 --- a/arch/x86/lib/bootm.c +++ b/arch/x86/lib/bootm.c @@ -27,10 +27,6 @@ DECLARE_GLOBAL_DATA_PTR; #define COMMAND_LINE_OFFSET 0x9000 -__weak void board_quiesce_devices(void) -{ -} - void bootm_announce_and_cleanup(void) { printf("\nStarting kernel ...\n\n"); diff --git a/common/bootm.c b/common/bootm.c index a0ffc1cd679..e789f6818aa 100644 --- a/common/bootm.c +++ b/common/bootm.c @@ -46,6 +46,10 @@ static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[], bootm_headers_t *images, ulong *os_data, ulong *os_len); +__weak void board_quiesce_devices(void) +{ +} + #ifdef CONFIG_LMB static void boot_start_lmb(bootm_headers_t *images) { diff --git a/include/bootm.h b/include/bootm.h index 9e42e179878..9f7956d2e35 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -72,4 +72,6 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, void *load_buf, void *image_buf, ulong image_len, uint unc_len, ulong *load_end); +void board_quiesce_devices(void); + #endif From patchwork Wed May 16 15:42:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914718 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="sZcfGdP+"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJqt0hhXz9s2R for ; Thu, 17 May 2018 01:53:14 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id AD89CC21F6A; Wed, 16 May 2018 15:50:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 11075C22012; Wed, 16 May 2018 15:44:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A2997C21FD3; Wed, 16 May 2018 15:43:07 +0000 (UTC) Received: from mail-it0-f45.google.com (mail-it0-f45.google.com [209.85.214.45]) by lists.denx.de (Postfix) with ESMTPS id 4A6C0C21FC5 for ; Wed, 16 May 2018 15:42:59 +0000 (UTC) Received: by mail-it0-f45.google.com with SMTP id e185-v6so1350119ita.0 for ; Wed, 16 May 2018 08:42:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hcXm1W04vvNqqg0X3KZKDU2TI+Rw2R2pWRG4SbmXm60=; b=sZcfGdP+0gWHTxcxFW7GBHvPAp8AOenHQ69vC58B1CDZsfS/TwijicfK/M8LCA8j8C /EpCSgLfTXAVyu7cmPUKAFE0WzueRVHbW6fkd/Unrd+EaWxQKqThcVp21D/K7w1aIKRE osFheWF/OTAiGJX1TmXDUn2fDbbKwICvpy+Yd+Qa3jhyBlMDRXMr6MMYQ6pLzcd3aXRF PtKqxhF9n2LpVlJXuuO4xnTV2cDpaeR9QfgB9YwkvK7qv3YccmvhDyhCQHr2LY/6HYLP 0qceIFyRss/16kznF3JMYnTcG+7HS/8slnlSQ5/pulyUdTylzMAiiRVTJqIAPi9ubkN2 4Uqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hcXm1W04vvNqqg0X3KZKDU2TI+Rw2R2pWRG4SbmXm60=; b=kjpOFKWsVAj8zV+wiUogMYlcF0dTZol0nEbV/y+GLiJWWRYWJgFoIar+y/FZOIcLXS vFrKzA5+jbrjtvbiXn5h6pE6VAnag6j5whLllJ4LpHExOuwHtGoQkcBTX97nQbFb+uxz lXK7vXv16aQjbGsSWTFzSVmUyTJhgrJUDRnVR03K/kQyqPO1wPnkH0RSpqVulAccT5Wu bfSRgekqNo3rG4ny3gm+Wg7bZBXAlY9BWrvxoNGty4oOCaZD42at+StyN8ySmc+/JqNa saIKm/52Pj7AJfjU1nHR6m+nP9FdoB/M68kCl0poFcKNqm7RQJyqwzKTgknanwUVu3oA BmVA== X-Gm-Message-State: ALKqPwdXly8qItW2Xs3Or+mRwYqdfkoDx7qo+z/f1bPILP4dP44291VQ xfCEptBmi4Dlmkyq/OGgDToDOA== X-Google-Smtp-Source: AB8JxZqIAQLWe6VzBZdA4M+RDDEA/nPWVDRzkWbTD+AebiCT0OPEGpW3REiRXjnyGJzU3jdJcu5Wpg== X-Received: by 2002:a24:7c17:: with SMTP id a23-v6mr1473720itd.47.1526485377843; Wed, 16 May 2018 08:42:57 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id p3-v6sm1611142itc.17.2018.05.16.08.42.56 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:56 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id DDEA8140474; Wed, 16 May 2018 09:42:55 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:26 -0600 Message-Id: <20180516154233.21457-10-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 09/16] Add a comment for board_quiesce_devices() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This exported function should have a comment describing what it does. Also it should really be removed in favour of device_remove(), which handles this sort of thing now. Add a comment with a TODO. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None include/bootm.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/bootm.h b/include/bootm.h index 9f7956d2e35..0501414e0dc 100644 --- a/include/bootm.h +++ b/include/bootm.h @@ -72,6 +72,12 @@ int bootm_decomp_image(int comp, ulong load, ulong image_start, int type, void *load_buf, void *image_buf, ulong image_len, uint unc_len, ulong *load_end); +/* + * boards should define this to disable devices when EFI exits from boot + * services. + * + * TODO(sjg@chromium.org>): Update this to use driver model's device_remove(). + */ void board_quiesce_devices(void); #endif From patchwork Wed May 16 15:42:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914724 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="UcBxANG8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJsL0gchz9s3B for ; Thu, 17 May 2018 01:54:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BE452C21FC7; Wed, 16 May 2018 15:51:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id C8A9CC22022; Wed, 16 May 2018 15:44:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id AD86BC22022; Wed, 16 May 2018 15:43:08 +0000 (UTC) Received: from mail-it0-f65.google.com (mail-it0-f65.google.com [209.85.214.65]) by lists.denx.de (Postfix) with ESMTPS id 2DA5CC21F47 for ; Wed, 16 May 2018 15:43:00 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id c3-v6so3081499itj.4 for ; Wed, 16 May 2018 08:43:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=hO/TdWo6SUVjKzzZr4IAlUVy8fSsGy7TnkwgK0Q9SBc=; b=UcBxANG8Oxs+6ph0pTgK2pcdkA9IdQkx0UnL+GwA8n5HkJUuscWssM0R/FEk548ME3 QSUC1McrQnUMiuHN7dMJxXnxtBxAdjnFCWM6UvVSGtm//e8N7KgRxVCHbFj/2/+10oh9 cB3OfLqjNH4PkiP+OIX6VyOpQVNxbcEgZtna07F9f7hVXYbPE5mdPWjdQT6lLNrvM0Ee BA+e02YWXVcAf6vA3pBdiZRqeNVvOcPneqbSnQEXEWlwT8AYQcs6LvXahKhAefmXR4HM 5VwNgdKnU20aA4zJaK5YA1vH6LjpT63tHFEaOw49b2h17sxnln0n6+uCEFmGJJHW44N+ LFXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=hO/TdWo6SUVjKzzZr4IAlUVy8fSsGy7TnkwgK0Q9SBc=; b=DvsBIqqPmteRBlMZcZgrR87l+TSHLpmywIcWVbbUfrX3S0YJvqnwnQKlVVnaorvFz5 DZlOfv8UOhLvsGhGsoa1wGDyqihiBa7XDwPa/+zo/Kwv/ffiEq1pBC0zZABilwiIxvBF b1ScmsHY86VYlsO3anVoM9TRodlHwUKqQaqjrH2hH7mI+tAjoKdhn3/lkV9nOz1HvuK1 2IAyav9mMNJEDKJBM08u+k/dZiBUCrLmXTVCuN7dZFZryjp4MTLCOjKS2hUuOCp1gXRf jy8X5wPM2JSYqH7jtKmkloBsap2JCqUPrul3fA40GRypteDztmREk6wGCMc4EFd8Cg6Z 27GA== X-Gm-Message-State: ALKqPwcRZg9RcdWBup6J/ZT9nMqmNPlb61PCEb+BAJiJTONCBabHAmmy nlMr8NCm68XnA2LB4k4f4CQPng== X-Google-Smtp-Source: AB8JxZqOg1yx3MmGxylvTqbx8qG9sv3y4oCN38HAT+fconym0au4qzI5NTM9+65U4bo7yMKxlTe6mQ== X-Received: by 2002:a24:9d44:: with SMTP id f65-v6mr1461302itd.119.1526485378806; Wed, 16 May 2018 08:42:58 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id e4-v6sm1416463iob.31.2018.05.16.08.42.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:58 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 6DCD6140208; Wed, 16 May 2018 09:42:57 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:27 -0600 Message-Id: <20180516154233.21457-11-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 10/16] efi: sandbox: Add relocation constants X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add these so that we can build the EFI loader for sandbox. The values are for x86_64 so potentially bogus. But we don't support relocation within sandbox anyway. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: None Changes in v2: None lib/efi_loader/efi_runtime.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 52f1301d75b..ac02f64d967 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -47,6 +47,9 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); #include #define R_RELATIVE R_386_RELATIVE #define R_MASK 0xffULL +#elif defined(CONFIG_SANDBOX) +#define R_RELATIVE 8 +#define R_MASK 0xffffffffULL #else #error Need to add relocation awareness #endif From patchwork Wed May 16 15:42:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914728 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="AbtcVOFj"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJtD3x4pz9s2R for ; Thu, 17 May 2018 01:55:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 14F4AC22014; Wed, 16 May 2018 15:48:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 68B5FC21FEE; Wed, 16 May 2018 15:44:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id F1ADAC21FEA; Wed, 16 May 2018 15:43:08 +0000 (UTC) Received: from mail-it0-f68.google.com (mail-it0-f68.google.com [209.85.214.68]) by lists.denx.de (Postfix) with ESMTPS id D0B58C21FD8 for ; Wed, 16 May 2018 15:43:01 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id y189-v6so3019216itb.2 for ; Wed, 16 May 2018 08:43:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WqtW92RtUrSAcE/u6Z4bH31XBFc1oVO0cZFV6rZplaE=; b=AbtcVOFjzIj1Xl5Z8TFy8z26/2//1/D0BJws1oZ7V+vBSmx55jYFYMFJE/tWnEQUQI 0m0ATVgpf8wSPx/5c4qnsSmhP17QLXhm1CP+TI6gJsLf/qwAzrS+Lu5aJZ+3gHX2ZFCT K0PNnm0Rl9u+YVc/Y+mB0Z8bhfRitt+AIOWbVFMlCxUEKOcI7qPSGMeFPp1KfOTwzArL 5oRsTaq2eQFHgPmFv6hoDXnzE1sksTUrMc5fVdv2JlM0ys/CpTJ+eGzPsp4uLunnGp5S J0nVq3XhydjAoW0buJNzYQVeus6Al96QZ6VnYaVarKABkot7MUgXgt7BkGclIyHEss1n D7pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WqtW92RtUrSAcE/u6Z4bH31XBFc1oVO0cZFV6rZplaE=; b=gesgv40v7XCRcxH6cWTVBbUJEYEN/02RgBciJUsEGRvfs+Lmfr72Mp0Wuk0MsH6OY8 wMJ0A3nnEekJxSndCDi5yrD48hBssLW5qOQvnJ32V4RegcI9kzmbxi5f0O8ZtPoRbgNf Sg/61mLrdQRy6kQhCiM14GsHVvkPaEuMMau5YSY+b13lx4jbDeQF3PAjtGqcfufTGALl 7OcWX0gNouMT7GjzYLmFH1rm9ks9magaosgQiPSb28e1vwNibfzm7HdHVIym+Vcswo65 9daBPr+PUScTTe1RrJiS5etrptnMGqKouzN4guEGh5CR78BHQuvwCzN6XDMimi5hwtA3 zj5A== X-Gm-Message-State: ALKqPwfuszZuvP3IsPtWSkbjZsc6c7ovrUj7L1LwBe4GK7/DUFW58fbX N74GlEzB32cCDbnMiTrggOFjPg== X-Google-Smtp-Source: AB8JxZqLdbzUrdqEY4DbUPUjxxItxcwAZqf8J/jYqDmNL2GywDln/b57IAycEtyfJm5eL67431kHdA== X-Received: by 2002:a6b:ad8d:: with SMTP id m13-v6mr1602843ioo.52.1526485380222; Wed, 16 May 2018 08:43:00 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id i11-v6sm1790895itb.38.2018.05.16.08.42.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:42:59 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 0C7CE140208; Wed, 16 May 2018 09:42:59 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:28 -0600 Message-Id: <20180516154233.21457-12-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 11/16] efi: Add a comment about duplicated ELF constants X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" These constants are defined in arch-specific code but redefined here. Add a TODO to clean this up. Signed-off-by: Simon Glass Reviewed-by: Heinrich Schuchardt --- Changes in v4: None Changes in v3: None Changes in v2: None lib/efi_loader/efi_runtime.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index ac02f64d967..e94b94389d8 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -36,6 +36,10 @@ static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); #define EFI_CACHELINE_SIZE 128 #endif +/* + * TODO(sjg@chromium.org): These defines and structs should come from the elf. + * header for each arch (or a generic header) rather than being repeated here. + */ #if defined(CONFIG_ARM64) #define R_RELATIVE 1027 #define R_MASK 0xffffffffULL From patchwork Wed May 16 15:42:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914709 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="YzgNFwqI"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJlw6PfWz9s33 for ; Thu, 17 May 2018 01:49:48 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 624C3C21FC0; Wed, 16 May 2018 15:46:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 4AADCC21F98; Wed, 16 May 2018 15:43:49 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B1477C21F63; Wed, 16 May 2018 15:43:08 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id C28ABC21FD3 for ; Wed, 16 May 2018 15:43:03 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id z6-v6so2995140iti.4 for ; Wed, 16 May 2018 08:43:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=p+SsfdX78+uo7YT8wJiHSZ4caikgCsNzTdSRdUkCYYM=; b=YzgNFwqIJpaic5SZ9cJPTz3eVknztpG9hLJ79ToNxyJCpJKwIp+1Gge5qDKg4I9Yau I9pUFyZyXF2tlHxw9PWvMvWdIBxV4QO0QR9rbBGu13BhRU57GqmBgvUom2TMXTfwI985 yO8XoixAgz204V3EbwiEpqjfK4HVXutm5UHW6FFjNd6MStk4Dcqcm0YZug7wIeafoNsp HTezs1OHUUv40V9HbgL4e/kHxo/IKsE0ZbOGhm6KLIeeGVGEHxDVEK7VsbPd2VbAfxAb +rPymLRIllpcq4viqajVnBwj4lfvpmiHPibnCL1o0Qg2MAuQLYGh1k02XD28FFPci2tE 0umw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=p+SsfdX78+uo7YT8wJiHSZ4caikgCsNzTdSRdUkCYYM=; b=G6l+/j1ny9XDUkaubdcOd4S0A2/vobg8U4V4LhpqYN3pLVXmvqIHzqmBgjYqhnU4PJ oT23haEo8t8wnS5BNm469Z+Bk23Y+ld3FR3xoFiO4nWUWwiivGHqbRNbKkeZozLzGmao tqw+x+ZGmhkjqLL8M3DfloHqqhq38E+r13E9YO5B1KAyVXPu/6R+TNBvDERWHjo4O3Ni /dtP/MDIsPCVdVdz28VLqLPRD65N8pcFTAG2TjZiSrbIhFHi+9AZ4wjXA89hrpAEDkMg uzMBvXR0Ph2jHoaxWckx+ArTIXGNupWQeLIwsUHKH6QyZXKyiDVUcseZ4sALFLBEGTES gvuw== X-Gm-Message-State: ALKqPwdzyDha5ncjLCJdd0t93opgbDfwPA5dZWoIOS9ZpiZElpPKjqTg S7a97NdaTqqi0L347ia4PD6U5g== X-Google-Smtp-Source: AB8JxZqImf3ANsDdwH0VFnnOYSITo3HSRB5tri7M/lCLdi3Ut7KdKwAqnopr1DMrZ1Vlja5b4zSf1Q== X-Received: by 2002:a6b:440c:: with SMTP id r12-v6mr1627541ioa.126.1526485382252; Wed, 16 May 2018 08:43:02 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id e4-v6sm1416511iob.31.2018.05.16.08.43.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:01 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 7F27D140208; Wed, 16 May 2018 09:43:00 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:29 -0600 Message-Id: <20180516154233.21457-13-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 12/16] efi: sandbox: Enable EFI loader builder for sandbox X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This allows this feature to build within sandbox. This is for testing purposes only since it is not possible for sandbox to load native code. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: - Init the 'rows' and 'cols' vars to avoid a compiler error (gcc 4.8.4) Changes in v2: None lib/efi_loader/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index d38780b604e..96107a90a90 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -1,6 +1,6 @@ config EFI_LOADER bool "Support running EFI Applications in U-Boot" - depends on (ARM || X86) && OF_LIBFDT + depends on (ARM || X86 || SANDBOX) && OF_LIBFDT # We do not support bootefi booting ARMv7 in non-secure mode depends on !ARMV7_NONSEC # We need EFI_STUB_64BIT to be set on x86_64 with EFI_STUB From patchwork Wed May 16 15:42:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914705 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="eJOCj0Rd"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJhR54fSz9s33 for ; Thu, 17 May 2018 01:46:47 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 603FAC21FC0; Wed, 16 May 2018 15:45:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 97BCDC21F8E; Wed, 16 May 2018 15:43:35 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id CD94BC21FDA; Wed, 16 May 2018 15:43:10 +0000 (UTC) Received: from mail-it0-f44.google.com (mail-it0-f44.google.com [209.85.214.44]) by lists.denx.de (Postfix) with ESMTPS id A6884C21FAD for ; Wed, 16 May 2018 15:43:04 +0000 (UTC) Received: by mail-it0-f44.google.com with SMTP id 70-v6so3119096ity.2 for ; Wed, 16 May 2018 08:43:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=DBi/N6eMcMBxUdwqB//G7w4Xg4krb8guFT1IYmonWno=; b=eJOCj0RdV+62Cz8cqvzWVI0ifFkZGW7aUswRHQ1P9wjxof1U5NrjLLNnn/lTSaHj/i bEjFgrEYdgfzzDSnkNOMfqepsna79mTVWV1+eMkPhQ3lu+AfhS0EENvN1VkRCfmA+zSH iqiW7Re/kdHTAr7IanaDMqM1b8aLKmeAZTlzV36rRbMrkqzKrZt4zy3/bcP8fbiq8eKA ZI4hsQFxIwMNLGq0OSLhBsF1502ziynxkkQUQC+ilnJMzLuIhqaiUK8WQ9wPJYjTgDl9 2gXERdsUV8advEFcle4NvK4RXn4wKudktHbjB0RIgRMh9rc/uE5KwNgqPjM76OHqmdTb Dcnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=DBi/N6eMcMBxUdwqB//G7w4Xg4krb8guFT1IYmonWno=; b=czQuLhr7zy1JSdcCU4b4j6iM8dJtstZRxrrLUjgcJFqtIuo6ZcLeT/XmpPBmh+j0ki PrLaHEp1p8R64uZeqaS4fyx35k5efczQDfStYZccDDczsLGHx90Sqd0tRK0Us8ufaEL4 STiMKsvzgHbKrGswvP9KH0/A24qL1042gaZ6oSS63h7DE9of9UO/H4G7mnqBMsmAWZjs KsfjODODDwgSa8YS5V/u7HztVO0GkuPBCESQtd66MVc0idi9djyEx169ombL6BeuJ0Cz nu3oCZF6801jNbOKoE+4j+pftbzVdPM+JzniHTjKxhJAv8+yF6gla72rqnjz5eD8ZQwY dAtw== X-Gm-Message-State: ALKqPwcHCsTUFWHpQAPy6m+tYUw/lvCRhRwdkWJHZzwv8GxoENuDUF4e Sf4cly5ed71ozWBQDE2lRT6kVA== X-Google-Smtp-Source: AB8JxZpU2bbIagyF2pHh+ohdUOJzT/tygCtLP6T+c1XgE/fkhS2vccdzW2mbx4/oENDHB7sx6IsDcQ== X-Received: by 2002:a24:42c6:: with SMTP id i189-v6mr1490893itb.73.1526485383159; Wed, 16 May 2018 08:43:03 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id k14-v6sm1608597iok.10.2018.05.16.08.43.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:02 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 433B4140474; Wed, 16 May 2018 09:43:02 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:30 -0600 Message-Id: <20180516154233.21457-14-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 13/16] efi: Split out test init/uninit into functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We plan to run more than one EFI test. In order to avoid duplicating code, create functions which handle preparing for running the test and cleaning up afterwards. Also shorten the awfully long variable names here. Signed-off-by: Simon Glass --- Changes in v4: None Changes in v3: - Add new patch to split out test init/uninit into functions Changes in v2: None cmd/bootefi.c | 93 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 26 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 11b84c55289..9bcdf8bdc48 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -335,6 +335,64 @@ exit: return ret; } +#ifdef CONFIG_CMD_BOOTEFI_SELFTEST +/** + * bootefi_test_prepare() - prepare to run an EFI test + * + * This sets things up so we can call EFI functions. This involves preparing + * the 'gd' pointer and setting up the load ed image data structures. + * + * @image: Pointer to a struct which will hold the loaded image info + * @obj: Pointer to a struct which will hold the loaded image object + * @path: File path to the test being run (often just the test name with a + * backslash before it + * @test_func: Address of the test function that is being run + * @return 0 if OK, -ve on error + */ +static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, + struct efi_object *obj, + const char *path, ulong test_func) +{ + efi_status_t ret; + + memset(image, '\0', sizeof(*image)); + memset(obj, '\0', sizeof(*obj)); + /* Construct a dummy device path */ + bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, + test_func, test_func); + bootefi_image_path = efi_dp_from_file(NULL, 0, path); + efi_setup_loaded_image(image, obj, bootefi_device_path, + bootefi_image_path); + /* + * gd lives in a fixed register which may get clobbered while we execute + * the payload. So save it here and restore it on every callback entry + */ + efi_save_gd(); + /* Initialize and populate our EFI object list */ + ret = efi_init_obj_list(); + if (ret) + return ret; + /* Transfer environment variable efi_selftest as load options */ + set_load_options(image, "efi_selftest"); + + return 0; +} + +/** + * bootefi_test_finish() - finish up after running an EFI test + * + * @image: Pointer to a struct which holds the loaded image info + * @obj: Pointer to a struct which holds the loaded image object + */ +static void bootefi_test_finish(struct efi_loaded_image *image, + struct efi_object *obj) +{ + efi_restore_gd(); + free(image->load_options); + list_del(&obj->link); +} +#endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ + static int do_bootefi_bootmgr_exec(void) { struct efi_device_path *device_path, *file_path; @@ -410,33 +468,16 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { - struct efi_loaded_image loaded_image_info = {}; - struct efi_object loaded_image_info_obj = {}; - - /* Construct a dummy device path. */ - bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, - (uintptr_t)&efi_selftest, - (uintptr_t)&efi_selftest); - bootefi_image_path = efi_dp_from_file(NULL, 0, "\\selftest"); - - efi_setup_loaded_image(&loaded_image_info, - &loaded_image_info_obj, - bootefi_device_path, bootefi_image_path); - /* - * gd lives in a fixed register which may get clobbered while we - * execute the payload. So save it here and restore it on every - * callback entry - */ - efi_save_gd(); - /* Initialize and populate EFI object list */ - efi_init_obj_list(); - /* Transfer environment variable efi_selftest as load options */ - set_load_options(&loaded_image_info, "efi_selftest"); + struct efi_loaded_image image; + struct efi_object obj; + + if (bootefi_test_prepare(&image, &obj, "\\test", + (uintptr_t)&efi_selftest)) + return CMD_RET_FAILURE; + /* Execute the test */ - r = efi_selftest(loaded_image_info_obj.handle, &systab); - efi_restore_gd(); - free(loaded_image_info.load_options); - list_del(&loaded_image_info_obj.link); + r = efi_selftest(obj.handle, &systab); + bootefi_test_finish(&image, &obj); return r != EFI_SUCCESS; } else #endif From patchwork Wed May 16 15:42:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914733 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="OJTGlMsf"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJx02SBDz9s3B for ; Thu, 17 May 2018 01:57:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 0DD6FC21F5B; Wed, 16 May 2018 15:52:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 19E4CC22024; Wed, 16 May 2018 15:44:59 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 1B17CC21FAE; Wed, 16 May 2018 15:43:13 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id 0DB2AC21FB5 for ; Wed, 16 May 2018 15:43:07 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id c3-v6so3082626itj.4 for ; Wed, 16 May 2018 08:43:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=+20b9yX0va5THsORS3LybCXe/p1w3AMJ1bQsr1YrqFc=; b=OJTGlMsforBmmgPcEhsON+7B4E2PuKwdO/apTkb6x20eOen2OY7kdcYocsdxnjQSQf Cxj803RQwUCw2PzNYhF721Pjdpc9+6ExvMtOVj6z2q2jUwARqUl0X6UkHWTi9DXTvkz5 nbmWnGoQHzXIs9HNh0L5C92RnxLwHnmm75b+U48qgnaaEurzNiipwFMTigcz7xRePSl2 XmMd8SYdJ/424Z+C67BTf0pF3ps3UExt/DU4EEOCyfhkhjqH+aCJ29YNvfXq0YVkq0SO s8x1K5G1/KVsHVQ+DHyh9lYr7oApm0atbJds2cHNSxn0T4qcnPqdO0cqu0gd9nnJgfZE k0nQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=+20b9yX0va5THsORS3LybCXe/p1w3AMJ1bQsr1YrqFc=; b=p0nPlqYF9EKeYW8aYagBOUaaYe10EFxonlmbxVS1UNUZgWKHAuVzx0HasXKhzepACq 05l4CRWpLmWOR13R2txFx5+DH9M6ozhf8zY1yzUOMwVrSn1Dwc6K9R+Vp/q681rWCrm6 J/Ds6n4qfLlaOJ8+I07QAmH5xwIHyry1mvKqkbPU/1lCJ4Jn92z1vnUYpyp7CyaEzpxj IzOggbuqitL1cISlvXU15PID/wYRnaJ9W6b06FSwMZ5TBgSAiLYtK7t4tE74gtlXhCKa BnqDs5x0If4i4ozyNrcAv9JRQXO2LS8h05gcvUFEdFWwz3sBX5QkQg9rBvTi8+Qci00c OgNQ== X-Gm-Message-State: ALKqPwdCNVx0L124+rXR5ro29u2ZYMQtjJr/SUIY1A7vOSCMrZxfNEha GMc5rL+CvcUtmWOcJtm+bi1WGQ== X-Google-Smtp-Source: AB8JxZrgtHnyW+qv/Z25rJ5YZ2Robzmi6m6KAsrBwqQ0vV/S1xGnp41kzvA7HVWJVySEjuschMJc3g== X-Received: by 2002:a6b:3bd6:: with SMTP id i205-v6mr1592451ioa.86.1526485385538; Wed, 16 May 2018 08:43:05 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id o205-v6sm1662001itd.6.2018.05.16.08.43.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:04 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id ED10F140208; Wed, 16 May 2018 09:43:03 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:31 -0600 Message-Id: <20180516154233.21457-15-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 14/16] efi: sandbox: Add a simple 'bootefi test' command X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This jumps to test code which can call directly into the EFI support. It does not need a separate image so it is easy to write tests with it. This test can be executed without causing problems to the run-time environemnt (e.g. U-Boot does not need to reboot afterwards). For now the test just outputs a message. To try it: ./sandbox/u-boot -c "bootefi test" U-Boot 2017.09-00204-g696c9855fe (Sep 17 2017 - 16:43:53 -0600) DRAM: 128 MiB MMC: Using default environment In: serial Out: serial Err: serial SCSI: Net: No ethernet found. IDE: Bus 0: not available Found 0 disks Hello, world! Test passed Signed-off-by: Simon Glass --- Changes in v4: - Rebase to master - Update SPDX tags Changes in v3: - Rebase to master Changes in v2: - Rebase to master cmd/bootefi.c | 26 ++++++++++++++++++++------ include/efi_loader.h | 3 +++ lib/efi_loader/Kconfig | 10 ++++++++++ lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_test.c | 16 ++++++++++++++++ 5 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 lib/efi_loader/efi_test.c diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 9bcdf8bdc48..46bd80d2077 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -335,7 +335,6 @@ exit: return ret; } -#ifdef CONFIG_CMD_BOOTEFI_SELFTEST /** * bootefi_test_prepare() - prepare to run an EFI test * @@ -391,7 +390,6 @@ static void bootefi_test_finish(struct efi_loaded_image *image, free(image->load_options); list_del(&obj->link); } -#endif /* CONFIG_CMD_BOOTEFI_SELFTEST */ static int do_bootefi_bootmgr_exec(void) { @@ -423,8 +421,10 @@ static int do_bootefi_bootmgr_exec(void) /* Interpreter command to boot an arbitrary EFI image from memory */ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) { - unsigned long addr; + struct efi_loaded_image image; + struct efi_object obj; char *saddr; + unsigned long addr; efi_status_t r; void *fdt_addr; @@ -466,11 +466,25 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) memcpy((char *)addr, __efi_helloworld_begin, size); } else #endif + if (IS_ENABLED(CONFIG_BOOTEFI_TEST) && !strcmp(argv[1], "test")) { + int ret; + + if (bootefi_test_prepare(&image, &obj, "\\test", + (ulong)&efi_test)) + return CMD_RET_FAILURE; + + ret = efi_test(&image, &systab); + bootefi_test_finish(&image, &obj); + if (ret) { + printf("Test failed: err=%d\n", ret); + return CMD_RET_FAILURE; + } + printf("Test passed\n"); + + return 0; + } #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { - struct efi_loaded_image image; - struct efi_object obj; - if (bootefi_test_prepare(&image, &obj, "\\test", (uintptr_t)&efi_selftest)) return CMD_RET_FAILURE; diff --git a/include/efi_loader.h b/include/efi_loader.h index 2519a7c33a7..a19f1eaef24 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -435,6 +435,9 @@ efi_status_t EFIAPI efi_set_variable(s16 *variable_name, void *efi_bootmgr_load(struct efi_device_path **device_path, struct efi_device_path **file_path); +/* Perform EFI tests */ +int efi_test(efi_handle_t image_handle, struct efi_system_table *systab); + #else /* defined(EFI_LOADER) && !defined(CONFIG_SPL_BUILD) */ /* Without CONFIG_EFI_LOADER we don't have a runtime section, stub it out */ diff --git a/lib/efi_loader/Kconfig b/lib/efi_loader/Kconfig index 96107a90a90..59bdd389f4f 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -24,3 +24,13 @@ config EFI_LOADER_BOUNCE_BUFFER Some hardware does not support DMA to full 64bit addresses. For this hardware we can create a bounce buffer so that payloads don't have to worry about platform details. + +config BOOTEFI_TEST + bool "Provide a test for the EFI loader" + depends on EFI_LOADER && SANDBOX + default y + help + Provides a test of the EFI loader functionality accessed via the + command line ('bootefi test'). This runs within U-Boot so does not + need a separate EFI application to work. It aims to include coverage + of all EFI code which can be accessed within sandbox. diff --git a/lib/efi_loader/Makefile b/lib/efi_loader/Makefile index c6046e36d26..2da28f9c90c 100644 --- a/lib/efi_loader/Makefile +++ b/lib/efi_loader/Makefile @@ -23,3 +23,4 @@ obj-$(CONFIG_DM_VIDEO) += efi_gop.o obj-$(CONFIG_PARTITIONS) += efi_disk.o obj-$(CONFIG_NET) += efi_net.o obj-$(CONFIG_GENERATE_SMBIOS_TABLE) += efi_smbios.o +obj-$(CONFIG_BOOTEFI_TEST) += efi_test.o diff --git a/lib/efi_loader/efi_test.c b/lib/efi_loader/efi_test.c new file mode 100644 index 00000000000..4b8d49f324b --- /dev/null +++ b/lib/efi_loader/efi_test.c @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (c) 2017, Google Inc. + */ + +#include +#include + +int efi_test(efi_handle_t image_handle, struct efi_system_table *systable) +{ + struct efi_simple_text_output_protocol *con_out = systable->con_out; + + con_out->output_string(con_out, L"Hello, world!\n"); + + return 0; +} From patchwork Wed May 16 15:42:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914717 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="A5oacm4p"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJqn015gz9s2R for ; Thu, 17 May 2018 01:53:08 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 2F62AC21F6A; Wed, 16 May 2018 15:52:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0E19FC2200E; Wed, 16 May 2018 15:44:56 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9C6AFC22024; Wed, 16 May 2018 15:43:15 +0000 (UTC) Received: from mail-it0-f51.google.com (mail-it0-f51.google.com [209.85.214.51]) by lists.denx.de (Postfix) with ESMTPS id 17B9AC21FC5 for ; Wed, 16 May 2018 15:43:09 +0000 (UTC) Received: by mail-it0-f51.google.com with SMTP id q72-v6so3140849itc.0 for ; Wed, 16 May 2018 08:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=WjCfdPnAq+7xn9v/wDtN3c7e1Rnp8394GVunSiBXrSI=; b=A5oacm4pz9UewJRlgDzfpVg0EQAcpNaXLC8vsKGYAZCpHiW384RNtX6hvfp9fjEiU/ EXTVRXLF2QO6hCCBcwIxNvhewEj44pDb0Bqokmw4JMfbYKKCdMDeYChoOHuLrBdEE9YU 95Ja345tkD1GUJxJSG8iy/6UIn0Pj3/2O2+VuewWhgWMnECHTQm8nryCivF3x/Nv6veU 9Hf/TwNtJ/xx3MeONoAhJRt4OTIDlsvSwuF7RXUxm+c5B36C0nBcEJQ/I1RrmmJnule6 zW7jLV03xsU/foXQfDYIkf3HjuSRDD41pZXIOE6HAvsfvmOHvlBwO2Z5XYQCCOIMhA1V veCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=WjCfdPnAq+7xn9v/wDtN3c7e1Rnp8394GVunSiBXrSI=; b=IB6efy01Doi66HmgQqJ1Zj4rFFg91CkOe+/pDN1izGAmlWQnFHMiFNW0V48NHp6xnc 6JvI67PdtAhN5IBQxrL/XvoebOeyBePZazDrxH04i6F7zU664lm1MdjVxyNzORU/AvEk UwykIwdmLb1qmvSyQTuxTTBSc8uUfSoehEKmuFCLrT5HasUdLm7fVwWjmdkQvCJlxWIa I9UrxGgHUY/FhKyCpJIn1TFdWp4URqNoe7sXuFydGZQyh8Xcy2H1alnqgjhsOBaQLSnn D72zrS4B0/2exekFHFZ2ZEEZup7ZBGZCUJSlO9pHZSRpwAOcthcTc7EYW5TjnqAQZrCa yOcA== X-Gm-Message-State: ALKqPwfxJMUR/m+6/U7TVX1n0jvSqQj3ZhiwOpa8DEoHT8x3MRuUD6tG 6UJWfe/3di932e1b2DdbP0tLOg== X-Google-Smtp-Source: AB8JxZrErwnxXVEct2FB/W/isS1wlzDNZGsDuQ3K6bZU4iDQPcVsvtGVDRINbIERXEo0c/wfcxcQdw== X-Received: by 2002:a24:cbc6:: with SMTP id u189-v6mr1639588itg.63.1526485387542; Wed, 16 May 2018 08:43:07 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id 194-v6sm1699934itm.32.2018.05.16.08.43.05 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:05 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 77604140474; Wed, 16 May 2018 09:43:05 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:32 -0600 Message-Id: <20180516154233.21457-16-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 15/16] efi: Create a function to set up for running EFI code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Add a new bootefi_run_prepare() function which holds common code used to set up U-Boot to run EFI code. Make use of this from the existing bootefi_test_prepare() function, as well as do_bootefi_exec(). Also shorten a few variable names. Signed-off-by: Simon Glass --- Changes in v4: - Rebase to master Changes in v3: - Add patch to create a function to set up for running EFI code Changes in v2: None cmd/bootefi.c | 82 +++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 46bd80d2077..23f05aa867a 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -241,6 +241,33 @@ static efi_status_t efi_install_fdt(void *fdt) return ret; } +static efi_status_t bootefi_run_prepare(struct efi_loaded_image *image, + struct efi_object *obj, + const char *path, + struct efi_device_path *device_path, + struct efi_device_path *image_path) +{ + efi_status_t ret; + + efi_setup_loaded_image(image, obj, device_path, image_path); + + /* Initialize and populate EFI object list */ + ret = efi_init_obj_list(); + if (ret) + return ret; + + /* + * gd lives in a fixed register which may get clobbered while we execute + * the payload. So save it here and restore it on every callback entry + */ + efi_save_gd(); + + /* Transfer environment variable bootargs as load options */ + set_load_options(image, path); + + return 0; +} + /* * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. @@ -249,8 +276,8 @@ static efi_status_t do_bootefi_exec(void *efi, struct efi_device_path *device_path, struct efi_device_path *image_path) { - struct efi_loaded_image loaded_image_info = {}; - struct efi_object loaded_image_info_obj = {}; + struct efi_loaded_image image; + struct efi_object obj; struct efi_device_path *memdp = NULL; efi_status_t ret; @@ -271,19 +298,13 @@ static efi_status_t do_bootefi_exec(void *efi, assert(device_path && image_path); } - efi_setup_loaded_image(&loaded_image_info, &loaded_image_info_obj, - device_path, image_path); - - /* - * gd lives in a fixed register which may get clobbered while we execute - * the payload. So save it here and restore it on every callback entry - */ - efi_save_gd(); + ret = bootefi_run_prepare(&image, &obj, "bootargs", device_path, + image_path); + if (ret) + return ret; - /* Transfer environment variable bootargs as load options */ - set_load_options(&loaded_image_info, "bootargs"); /* Load the EFI payload */ - entry = efi_load_pe(efi, &loaded_image_info); + entry = efi_load_pe(efi, &image); if (!entry) { ret = EFI_LOAD_ERROR; goto exit; @@ -291,10 +312,10 @@ static efi_status_t do_bootefi_exec(void *efi, if (memdp) { struct efi_device_path_memory *mdp = (void *)memdp; - mdp->memory_type = loaded_image_info.image_code_type; - mdp->start_address = (uintptr_t)loaded_image_info.image_base; + mdp->memory_type = image.image_code_type; + mdp->start_address = (uintptr_t)image.image_base; mdp->end_address = mdp->start_address + - loaded_image_info.image_size; + image.image_size; } /* we don't support much: */ @@ -304,8 +325,8 @@ static efi_status_t do_bootefi_exec(void *efi, /* Call our payload! */ debug("%s:%d Jumping to 0x%lx\n", __func__, __LINE__, (long)entry); - if (setjmp(&loaded_image_info.exit_jmp)) { - ret = loaded_image_info.exit_status; + if (setjmp(&image.exit_jmp)) { + ret = image.exit_status; goto exit; } @@ -317,7 +338,7 @@ static efi_status_t do_bootefi_exec(void *efi, /* Move into EL2 and keep running there */ armv8_switch_to_el2((ulong)entry, - (ulong)&loaded_image_info_obj.handle, + (ulong)&obj.handle, (ulong)&systab, 0, (ulong)efi_run_in_el2, ES_TO_AARCH64); @@ -326,11 +347,11 @@ static efi_status_t do_bootefi_exec(void *efi, } #endif - ret = efi_do_enter(loaded_image_info_obj.handle, &systab, entry); + ret = efi_do_enter(obj.handle, &systab, entry); exit: /* image has returned, loaded-image obj goes *poof*: */ - list_del(&loaded_image_info_obj.link); + list_del(&obj.link); return ret; } @@ -352,29 +373,14 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, struct efi_object *obj, const char *path, ulong test_func) { - efi_status_t ret; - memset(image, '\0', sizeof(*image)); memset(obj, '\0', sizeof(*obj)); /* Construct a dummy device path */ bootefi_device_path = efi_dp_from_mem(EFI_RESERVED_MEMORY_TYPE, test_func, test_func); bootefi_image_path = efi_dp_from_file(NULL, 0, path); - efi_setup_loaded_image(image, obj, bootefi_device_path, - bootefi_image_path); - /* - * gd lives in a fixed register which may get clobbered while we execute - * the payload. So save it here and restore it on every callback entry - */ - efi_save_gd(); - /* Initialize and populate our EFI object list */ - ret = efi_init_obj_list(); - if (ret) - return ret; - /* Transfer environment variable efi_selftest as load options */ - set_load_options(image, "efi_selftest"); - - return 0; + return bootefi_run_prepare(image, obj, path, bootefi_device_path, + bootefi_image_path); } /** From patchwork Wed May 16 15:42:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 914726 X-Patchwork-Delegate: agraf@suse.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="sQN4YKTd"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 40mJt50yCrz9s2R for ; Thu, 17 May 2018 01:55:09 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id CAF4BC21FD6; Wed, 16 May 2018 15:51:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 0D00BC21FF1; Wed, 16 May 2018 15:44:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7B8CFC21FC1; Wed, 16 May 2018 15:43:15 +0000 (UTC) Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by lists.denx.de (Postfix) with ESMTPS id DFC06C21FD1 for ; Wed, 16 May 2018 15:43:09 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id j186-v6so3075846ita.5 for ; Wed, 16 May 2018 08:43:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=2Mh1OOlGi1ycN99M29C+M1g5QjjnVI7QHQ5Miussg4Q=; b=sQN4YKTdDYulfR9TgUMKdBsMy7T4Mtvczwfp5JhrRIq3CgB3+pzR2zIgji3hlbRc1Y LV5+yqEKtTiWQsh4HJnD0K3rZ8a/7JNCOle20WcoPd3spSLsVI86lAQnNpwbn2+TqBfx c7NRo1hPJAV1jpCZ54Zj/PxACg1BVfXNYhu8LVWXfxlOjscFgq96gotPEEt8yrnu9ATw aypgUazTWGwofY6xHfzgATfo3P8nqFYabEEGDGnbrYiAoTjLUVWAMSgDqh83o82HLclZ Dg8Lu1qXTFAF2YwIAhtUwe8gCdCtTWJJ/O1GUAUQOZ0Px6o6+IKI/4fzjS9pYczKlYd7 z3IA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=2Mh1OOlGi1ycN99M29C+M1g5QjjnVI7QHQ5Miussg4Q=; b=tVfT9r1actK3pn7ktKDWvFYStGru/Qmy3DvQzt6L5izzpA7T18fd6abe+cgfLpME8K kclWG9tVOT4V3YgMIWQINIp2UKiK4O3gEk5Loi4Cu72luS70yesS+wmgXb5HyrP4dqya GKXJG5iRyFg79+91QAMtxk5dY1r1BOCt6Ruf5qNUmpgIzj8deVvVSOivPMNrSEdEcqKu BOVZrIofa6zC7cSNI6w/1PJGw2JYHEQlG/FS/fM+T9NZRTz2E2pVHFRSOy64Mz2LLMpr f2moGdFA7PcHy1niv7ShF+K6sTXPTTVeRCLR+6Ar9XirTCfdwHTmOh3Ar7odDsdFtfpX BFxQ== X-Gm-Message-State: ALKqPwcEGlyoJeLABhM5GrGSmYX6tVAD7EBvUHdLmZdrc43HKc/b2QFs x/51Wm6lFeT9vQ9nzoD7K0geXA== X-Google-Smtp-Source: AB8JxZqpSF2+Q5hk2Yx/OdjHXYot49B9NvLWUDT5VK/6S1xb3yClyQNWjK8JUtjNLnkNm+CElgCkNQ== X-Received: by 2002:a24:4092:: with SMTP id n140-v6mr1487463ita.139.1526485388350; Wed, 16 May 2018 08:43:08 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id v18-v6sm1768352ita.19.2018.05.16.08.43.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 16 May 2018 08:43:07 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 15FEB140208; Wed, 16 May 2018 09:43:07 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Wed, 16 May 2018 09:42:33 -0600 Message-Id: <20180516154233.21457-17-sjg@chromium.org> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516154233.21457-1-sjg@chromium.org> References: <20180516154233.21457-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v4 16/16] efi: Rename bootefi_test_finish() to bootefi_run_finish() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" This function can be used from do_bootefi_exec() so that we use mostly the same code for a normal EFI application and an EFI test. Rename the function and use it in both places. Signed-off-by: Simon Glass --- Changes in v4: - Rebase to master Changes in v3: - Add new patch to rename bootefi_test_finish() to bootefi_run_finish() Changes in v2: None cmd/bootefi.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 23f05aa867a..00a94fc8560 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -268,6 +268,20 @@ static efi_status_t bootefi_run_prepare(struct efi_loaded_image *image, return 0; } +/** + * bootefi_run_finish() - finish up after running an EFI test + * + * @image: Pointer to a struct which holds the loaded image info + * @obj: Pointer to a struct which holds the loaded image object + */ +static void bootefi_run_finish(struct efi_loaded_image *image, + struct efi_object *obj) +{ + efi_restore_gd(); + free(image->load_options); + list_del(&obj->link); +} + /* * Load an EFI payload into a newly allocated piece of memory, register all * EFI objects it would want to access and jump to it. @@ -350,8 +364,7 @@ static efi_status_t do_bootefi_exec(void *efi, ret = efi_do_enter(obj.handle, &systab, entry); exit: - /* image has returned, loaded-image obj goes *poof*: */ - list_del(&obj.link); + bootefi_run_finish(&image, &obj); return ret; } @@ -383,20 +396,6 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, bootefi_image_path); } -/** - * bootefi_test_finish() - finish up after running an EFI test - * - * @image: Pointer to a struct which holds the loaded image info - * @obj: Pointer to a struct which holds the loaded image object - */ -static void bootefi_test_finish(struct efi_loaded_image *image, - struct efi_object *obj) -{ - efi_restore_gd(); - free(image->load_options); - list_del(&obj->link); -} - static int do_bootefi_bootmgr_exec(void) { struct efi_device_path *device_path, *file_path; @@ -480,7 +479,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_FAILURE; ret = efi_test(&image, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); if (ret) { printf("Test failed: err=%d\n", ret); return CMD_RET_FAILURE; @@ -497,7 +496,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) /* Execute the test */ r = efi_selftest(obj.handle, &systab); - bootefi_test_finish(&image, &obj); + bootefi_run_finish(&image, &obj); return r != EFI_SUCCESS; } else #endif