From patchwork Wed Jun 13 02:37:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 928620 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="NsP4Ioep"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159s73N1pz9s1B for ; Wed, 13 Jun 2018 12:37:46 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id BD343C21C93; Wed, 13 Jun 2018 02:37:39 +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_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 B0C58C21C27; Wed, 13 Jun 2018 02:37:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7B0EDC21C6A; Wed, 13 Jun 2018 02:37:35 +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 E0241C21C27 for ; Wed, 13 Jun 2018 02:37:34 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id m194-v6so1893180itg.2 for ; Tue, 12 Jun 2018 19:37:34 -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=+QhfoUV1fr3zwQBiSQx+mPL7ckQvxSOAAjwiWRcqO1Y=; b=NsP4IoephbjT+zlintApG3xbtyC3IvWxUWue61om7OQKUaBojPEBmJEViROI77Gf6w o0f9lTL5fUvM7Rgtb5yTZHMVbbKIokoqOHJco2wF+M+lO8aM7yYwoqyQNCVJw+Sg7f16 fIiUiZlQBflYPitxEN+wINI7e20dC47/jCBoKVvYI0rnl4/uzLFaIvhC9omGQ0ry2yW9 7xB40bSg1+NvQ/EWCdqE8pInmGISZuHAitV49mBVau4GyWGOWzB98m3BsbLd1ejK+mKd aVJhtKD4MWuEmH23w3GccGL4XzmS83KhrnJ+g1PUxNzjgS95Unv5ISRj7tTaw/nT8g// 4C+A== 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=+QhfoUV1fr3zwQBiSQx+mPL7ckQvxSOAAjwiWRcqO1Y=; b=bjjOEkeK0hG9rYHNCS21bnf0GuwdGSzs1Zzd1cezOMXC884o6uKzBmYPhhyxx9scYy +W7dO96oZFpI96OTT0xqm4cngqjMMpHO2H8YnOz3HCHvmwXAzPYN28jFyLCTrCfDENc4 klVCCcflHv1Bzjyb7ZXCLZILQzUHiXVvTyBFaelMK3HR5sS6yuRyEXdpK0SZrTOcxBNX HrVXYFX417xEHgUtpxP+G4MiJ6UOOIQEgDeXpaoCcXUsE8WQvoLhoIAqhH+O203AOozF 7KPQz9OEAfneQNAZb/zUa5+r396JgWF5lJ4U31UUdnGiRtKbuDQLjuQsN9TishHrai7T xn4w== X-Gm-Message-State: APt69E2g2C5ZddH/3q/X88uZEpssLHWCC/WA3DdjaYipcCgxAGTwReBQ YmFlTgyTmMKFX9yqFHDuzTl7Aw== X-Google-Smtp-Source: ADUXVKJjcB2Fy8NvJlOXwMLMzEPmpfOAkQ6YD+kM334g5CXA6MZ0e84odUIBw0W03PIaPV13SJkW8w== X-Received: by 2002:a24:30c4:: with SMTP id q187-v6mr2941411itq.35.1528857453269; Tue, 12 Jun 2018 19:37:33 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id f3-v6sm501610iob.49.2018.06.12.19.37.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:32 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id E2F0D14153C; Tue, 12 Jun 2018 20:37:31 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:16 -0600 Message-Id: <20180613023728.202173-2-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 01/13] efi: Don't allow CMD_BOOTEFI_SELFTEST on 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 does not work at present and gives the following error: output: 'ld.bfd: read in flex scanner failed scripts/Makefile.lib:390: recipe for target 'lib/efi_selftest/efi_selftest_miniapp_return_efi.so' failed It may be possible to figure this out with suitable linker magic but it does not seem to be easy. Also, we will be able to run the tests on sandbox without using the miniapp. So for now at least, disable this option. Signed-off-by: Simon Glass --- Changes in v6: None Changes in v5: - Add new patch to disallow CMD_BOOTEFI_SELFTEST on sandbox Changes in v4: None Changes in v3: None Changes in v2: None lib/efi_selftest/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/Kconfig b/lib/efi_selftest/Kconfig index 59f9f36801..b52696778d 100644 --- a/lib/efi_selftest/Kconfig +++ b/lib/efi_selftest/Kconfig @@ -1,6 +1,6 @@ config CMD_BOOTEFI_SELFTEST bool "Allow booting an EFI efi_selftest" - depends on CMD_BOOTEFI + depends on CMD_BOOTEFI && !SANDBOX imply FAT imply FAT_WRITE help From patchwork Wed Jun 13 02:37:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 928627 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="SH2cJqEp"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159zj2rJjz9s3R for ; Wed, 13 Jun 2018 12:43:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 116F2C21E45; Wed, 13 Jun 2018 02:38:16 +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_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 1BC34C21E2B; Wed, 13 Jun 2018 02:37:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 51424C21E0F; Wed, 13 Jun 2018 02:37:40 +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 DBEE5C21C93 for ; Wed, 13 Jun 2018 02:37:36 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id 16-v6so1868963itl.5 for ; Tue, 12 Jun 2018 19:37:36 -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=ifFKdk3xKk2YNhe3IiPbwTbrywje6pnIzWxneUo2IxU=; b=SH2cJqEpoknYFR1sU5THqMS73dUExW9bVBxMkdhw8I9hWKknAtld9SzkiUEvbsK4x8 CJDODc+MXEF/RBt5ezS1nsLe1+Pv+Sjhda9nC5AwEg4DotGlWnhjJLB1FX/wtq38cHm6 Iw13WoTdCGLjAMQAFQbcaHHxdD/w1TjpfAXFXvn8veujaN3drGSX163Rx3WfrMc+LMr0 5tZbQA58mlLR8cII27r7LiicD/d941FhEBdHhrn32g0WLdBMwHKG2wI/YtMYoAoGEAgF e/hSq5jjRUMfh2WLrgl9zDAxJQupjPGcYGG8vGXaJygFk/LBfzhktgNiJoMCjPE0/zB1 qdKg== 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=ifFKdk3xKk2YNhe3IiPbwTbrywje6pnIzWxneUo2IxU=; b=ek9DdJsbGiftWrPf4lpMclWIcKGLfEZoHoO8hwwAkQoNXHF+YOqckG4Wb0dw377QCo oqCr6YdS5bFFGmIw/VXjjc9qLwvkjTZV1wEJDbVpBHe0B69YwVG+L7P7/v1b6yCr3dEk XSmnLqeu9XHf29clEPF0OtiKzuyJDEPRTlwpv6bXX97ygzXa5MaL33FEUck8Wq+NOm5x gmVf8b5HIf+PFkKmVLb4+uumcA18WRHwiI1a1qOsuyr7Fx13IE+cGG+x2LYb9pBhoxBX Q7aBDggDBX9h4z2kAeeAuJL4NCDDC0kVISTnRmxmNkihp66OYo9A3vv/xA1FtbaQVylh YSHQ== X-Gm-Message-State: APt69E0V1IxY4wC/u3e6C4dmDBXQf/fD/Al9KAkShgeTZ+eh3wL2UF5a T4DlcCrmXZiAGZ4noEhERVY71A== X-Google-Smtp-Source: ADUXVKKJRWFDzZCSsYSLsssDM8VQcy1eNRm8xwE74eicMrZjshxZdgkxTskK4/Nb2EHkBdyZTgJc1A== X-Received: by 2002:a24:cac7:: with SMTP id k190-v6mr2846406itg.62.1528857455278; Tue, 12 Jun 2018 19:37:35 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id b100-v6sm959469itd.16.2018.06.12.19.37.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:33 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 6A2861404EA; Tue, 12 Jun 2018 20:37:33 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:17 -0600 Message-Id: <20180613023728.202173-3-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 02/13] 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 v6: None Changes in v5: None 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 ce66c935ec..bd953a1485 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -204,8 +204,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 Jun 13 02:37: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: 928622 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="rUmQAeNc"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159v63j4Mz9s3C for ; Wed, 13 Jun 2018 12:39:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 3050DC21E07; Wed, 13 Jun 2018 02:38:33 +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_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 E0227C21E26; Wed, 13 Jun 2018 02:37:50 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA3DDC21C8B; Wed, 13 Jun 2018 02:37:42 +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 ADD01C21DA1 for ; Wed, 13 Jun 2018 02:37:37 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id l6-v6so1956909iti.2 for ; Tue, 12 Jun 2018 19:37:37 -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=EiYcwDufTwAPJ++t+mGW5B/XX6Lfr7vGfEHbFwicfcQ=; b=rUmQAeNci0oJwxWWTKoi0tO32af7BBRlNtpFOW9Pt5E+FIqK6mwgsJ4IN1u3E2Uuh9 1I/n8TB1ZP5rGv4zOD+5oKlEovqhcrCPYoWnBHoVDeEmw53qeQl3arEb5Sywj6VVksJ+ BbjWQTekuNIzF2fSWAgE9k/PMWEDgHhzw6BrJuDXwp51TPfkkg585gmWc6HbV81t1rvA czNut8KHwakl7ZUivO69EWR8g1604Q+48VxqFqfMMYSsaNLN3knHYsHCE4L9eQ6hw1g9 2mbDyEKunMuJDgNQZKi2eivzASrZ6T5LipSigG+GE+R1pOYTx7T6aXPTPUqM1Br3VDPA calA== 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=EiYcwDufTwAPJ++t+mGW5B/XX6Lfr7vGfEHbFwicfcQ=; b=VcOULZ6A0H6BXSpeMFHeLwDjbdXQ2IuQ33Dk3mc6AjSnn6GfetAylnZVSj/Sesma2a 3YouqNQIVa6UY/W9PoId3d4vVL0uevUYmy8Uiy1BZ7VTOeK9fTdIgGa5GwNdUI7LbWEY otvAqp25UJbmsLvnF3B4oVC6CosKKC4XCYyOrzM6Q3s4jxvifogQ5ddlWdYyXM6QYuRa fh9t2q3XabZyMdLkpa1AZDBMwY/OT/iWLd+92GuFGcces1e11RqdzgUeYTaXpLPcUC9k 8HBq18j2Ldzm3YKPEE1qt/FLgt72TDzj56xs6wjbxkYQUJYdlFZ23KfUIrooISXMx1Ov iPnw== X-Gm-Message-State: APt69E2qOzEU4RHhwTMaC8qhRPXg5JpcsLdbUQyXDBTqCdIf5nS5764R 1hk6dyFyCAlBepcgxJt0UMa4ow== X-Google-Smtp-Source: ADUXVKJay8ito8mqrRM4wH2Cl0Ur8Ph2LsmhiwcXJKYLIkyQvq7089Y06PQeh2+wICjy+nepKYnUGg== X-Received: by 2002:a24:4a02:: with SMTP id k2-v6mr2969687itb.128.1528857456053; Tue, 12 Jun 2018 19:37:36 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id n4-v6sm491548ioc.76.2018.06.12.19.37.35 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:35 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id CBB9414153C; Tue, 12 Jun 2018 20:37:34 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:18 -0600 Message-Id: <20180613023728.202173-4-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 03/13] 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 v6: None Changes in v5: None 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 ec66af98ea..210e49ee8b 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 @@ -393,7 +394,7 @@ efi_status_t efi_allocate_pool(int pool_type, efi_uintn_t size, void **buffer) &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; } @@ -504,18 +505,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 Jun 13 02:37: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: 928630 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="ct+C783P"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B0c2hDdz9s1B for ; Wed, 13 Jun 2018 12:44:16 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 09A45C21C27; Wed, 13 Jun 2018 02:40:15 +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_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 EDBB4C21E1D; Wed, 13 Jun 2018 02:38:12 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BA9D5C21DA6; Wed, 13 Jun 2018 02:37:43 +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 7DB2BC21E12 for ; Wed, 13 Jun 2018 02:37:39 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id j135-v6so1967069itj.1 for ; Tue, 12 Jun 2018 19:37:39 -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=sgSL7fe0PrkyGQfHIXf/CB3GbAOkBoS8Ji/d74LLYJo=; b=ct+C783PEXlM9bBjFlFx5LG/x95RULLF9KPVtkLxtSqS6tRaHu/nX1VOST8yW4rFf4 xulmko94CjnqLca8Go2G/EhCZJrERRF5Fhb9kyoYTzzGgA/9pzTlxab1uOM5gAs5VUw9 xQvop14MkQA65hkxrt/NWLGDGLIycOqbvoQ/RhEglMwyBcECDH1w2G5/JAXq0HC+qfst A3kV8hc61W1mqGmi4FUWHRTafphHRyQmL4slVKJKlKfCyqOYYoU+ajAdQgMJteuf8B9z AzEJEkDgGp4eQvSmqzzBEgr55g3N2fkaSG3Wp1xVgWZXGzcVH6oIpmUsIqYRhvp9x9Sl 95bw== 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=sgSL7fe0PrkyGQfHIXf/CB3GbAOkBoS8Ji/d74LLYJo=; b=b6op78QNCRlTeQSsHdftdox/YvBPMp5U7pAVLRLQKxN0wwgReksXWXcojw6CATVqnY KaiB4eMI4yXMkrWt7W9SvyfyGFtlifmK5mHPxE1oYiRUDf+NP7v8NJKNccBdOU1zT+Zh gixj8xpkcU4nDsQTPPdnRq1ni1O0mlFlXdiG1lE2TZjWZCHSgcsRXlHOnauwbTPvYfju 16h9R+YR6abZlEajmXUNW5/5HASjF2o6aZULh5b1PpJoUqt3IlV1x3qryJgsX0IX42mo FRKhdDprEgeWD6SCUShkvY9oPWRAVYp1a7hLo28MlulRoyJC2FW/oE9Js/y7GngOsDEu yAJw== X-Gm-Message-State: APt69E1tcl9YDuBnm1Ss9EGjcFa2Nw6uipIChPWZRkl99/PgHfWEdDoG XrAGKLLTS3ai+wOtpeV89EDj7g== X-Google-Smtp-Source: ADUXVKKnu5819Uk2aqsUriKopENozLquPlYYABM+mCeKd0w2pMTg2KmR42RqkZ00AQOXF8OGl41DNA== X-Received: by 2002:a24:dd3:: with SMTP id 202-v6mr2971626itx.77.1528857457919; Tue, 12 Jun 2018 19:37:37 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id h68-v6sm1019467ith.28.2018.06.12.19.37.36 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:36 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 1F3611404EA; Tue, 12 Jun 2018 20:37:36 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:19 -0600 Message-Id: <20180613023728.202173-5-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 04/13] 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 v6: None Changes in v5: None 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 df3d26b071..fc3dabcbc1 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 Jun 13 02:37: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: 928623 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="SclmSAwT"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159vJ5Tqlz9s1B for ; Wed, 13 Jun 2018 12:39:40 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5D3A0C21DED; Wed, 13 Jun 2018 02:39: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_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 48D02C21E18; Wed, 13 Jun 2018 02:38:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E05B7C21C27; Wed, 13 Jun 2018 02:37:45 +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 E07DDC21E1E for ; Wed, 13 Jun 2018 02:37:41 +0000 (UTC) Received: by mail-it0-f67.google.com with SMTP id k17-v6so15790577ita.0 for ; Tue, 12 Jun 2018 19:37:41 -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=BCmJjfW7jtu/twsjrGXvU7F4v7jchoYLtds25GSV6XA=; b=SclmSAwTIACG5OTfNKveeDKdwE5xyg327FNEq1lzNLUQsSvn5YPN3D4dVj8ye/dhHv FHEffACPxklZgAm8IuDc4etNjvR0qUT1G5/R78/yO0rq6TpSFrRV2YbMer4aT85a2BiY +UTcc5N2kIh4+109MwVDMMT8w2NI5/6HBUzJ6RnK9VEHYFotLXQ9JtIG/FNqc70jyfHM QMf3kd3NNZ8M10AhXUztJJ2j8le4LuvR9HNn4XUA6kGeRCL3qMmVqmf63DY1/e6uYHrb C8s6hsi+lbmkIrHh74KzN1F7V88mGzQt8PK8R3UFhXfBLE0araw2S/DvJMXUKB4AvqXi I/pw== 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=BCmJjfW7jtu/twsjrGXvU7F4v7jchoYLtds25GSV6XA=; b=XRQ3BV2otoKOGEHx86/NOT4c8ysHG+6ELYtmxiu1YLR77lDgz+z/FvGU+SFaRznyZZ X+JEMvkPNIiCfh8ljWA4w5nkQ6KYsJ7pTOxPchrHdjqKmbFNFu7F0R5MXV25W5hfsDx2 nhqyKAOhVAreHhRuwabmNDBytIwj9rD0kezmOxsTjjxZlQupvUxFY6chjFsACawbLzXb 47ebsgRIaFBdMqZFTnUDejJQcb6YBTUnVKl6HkkggrroXh4nuZi/E6cTVp/1qg3ZBnI8 gMS/SRLJJIt3vDI2ZuZxpwdas0CuEuQiAa+WRyub4OUhEHEdUNgir3yMbaYM/DfOQFqO PZ3g== X-Gm-Message-State: APt69E3y4Fy47qD1NAhYjSgN88jCMSj8y99jchj+tLhj2dSBCrr7Vj60 liPHJXIFr4B4s7Ykfnzmckn3fA== X-Google-Smtp-Source: ADUXVKLjvzqTf2i9HABP+naw7EGf6gJtmVPCUWc7AfgNXNgHNnu74pB36Az1f66MeQH/aMwZxCl60Q== X-Received: by 2002:a24:1a10:: with SMTP id 16-v6mr3202231iti.66.1528857460347; Tue, 12 Jun 2018 19:37:40 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id q202-v6sm534795iod.30.2018.06.12.19.37.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:39 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 6B0EE14153C; Tue, 12 Jun 2018 20:37:37 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:20 -0600 Message-Id: <20180613023728.202173-6-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 05/13] 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 v6: - Warn about building sandbox EFI support on something other than __x86_64__ Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None include/config_distro_bootcmd.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h index d672e8ebe6..1bd79ae3b8 100644 --- a/include/config_distro_bootcmd.h +++ b/include/config_distro_bootcmd.h @@ -251,6 +251,8 @@ #elif defined(CONFIG_ARM) #define BOOTENV_EFI_PXE_ARCH "0xa" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00010:UNDI:003000" + +/* For sandbox we only support 64-bit x86 at present */ #elif defined(CONFIG_X86) /* Always assume we're running 64bit */ #define BOOTENV_EFI_PXE_ARCH "0x7" @@ -261,6 +263,17 @@ #elif defined(CONFIG_CPU_RISCV_64) #define BOOTENV_EFI_PXE_ARCH "0x1b" #define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00027:UNDI:003000" +#elif defined(CONFIG_SANDBOX) +/* + * TODO(sjg@chromium.org): Consider providing a way to enable sandbox features + * based on the host architecture + */ +# ifndef __x86_64__ +# warning "sandbox EFI support is only tested on 64-bit x86" +# endif +/* To support other *host* architectures this should be changed */ +#define BOOTENV_EFI_PXE_ARCH "0x7" +#define BOOTENV_EFI_PXE_VCI "PXEClient:Arch:00007:UNDI:003000" #else #error Please specify an EFI client identifier #endif From patchwork Wed Jun 13 02:37: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: 928632 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="usNx0yvy"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B2S1GjKz9s1B for ; Wed, 13 Jun 2018 12:45:52 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id D00A0C21CB6; Wed, 13 Jun 2018 02:39:57 +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_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 28760C21E50; Wed, 13 Jun 2018 02:38:11 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E2BBAC21D56; Wed, 13 Jun 2018 02:37:46 +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 96566C21DDC for ; Wed, 13 Jun 2018 02:37:42 +0000 (UTC) Received: by mail-it0-f68.google.com with SMTP id a3-v6so1976123itd.0 for ; Tue, 12 Jun 2018 19:37:42 -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=e/ZgE6gNG03IA1qr+t4EHj5e1sqUD4oMjWKlSneqfKs=; b=usNx0yvyo9aQeKAsqbITUmMc2b+YsRx3SXpJgy9FFRpQC6xaADCWDjOJ5rPmTf/7Up 0HORkjF+t+bbc/3s/YZ2lbGlPUocPDDG81q5n37D6P+dKwQ58/A9i5sOy446/1Ac4kcQ 09DNec0bt4dqgTffcXh7aDEQX0uJXUzcE3Nd03opjHSkHV60GCrYO8LCWLVnGyP+UI0B /VunTgwUpjDYIo4SlPOa2amnDUGYQjWmKzNGJFwFzgMzfazrjhM7n5AV0INFzEX72ieD lx83KkFtgjr+3boLmq2qul8BNIz8EQk38ukwdDNzBtRYuCy/72XCbk/uctN/nVNbb0Ab grMA== 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=e/ZgE6gNG03IA1qr+t4EHj5e1sqUD4oMjWKlSneqfKs=; b=fgdfh/3ZUL06oq3OvEVyfD8R6UPosXlUThf2UPUKX2Xw5b4NqS4sd5TSW5V7mqJdBg uoBmeAedAo0iVVuTYhc7qclg4RYz3/htXn5gmZN1Hkbpc4Mrun751ouMLcbodVux6zth ng85XHh83Us+JMjpp43w2tPjGX7aXaVMUxJkEd4R4Lu2MFXWJkWlr3ZJTqmCstyt+UiT jzn3hQbsP7lhGo60S6mw22LTqrq80FHer65ymC7RCZ8arsoBezxk36Ic70YNQr3xD3Hn xCI/UbEorGFW7c0DGDFU7UBAk1OURJTyfSdkWgAN+eVgMWlyWBN+TWT3YAbFmzbCntUH DR7w== X-Gm-Message-State: APt69E272GviH73ACkr0abaB5dbtb2WR4HXi9fpRfYnEgTdYO4kB5xdk 5KOF8/hdnYEee2g6vcM0BmYDQQ== X-Google-Smtp-Source: ADUXVKLj7JK20aVUwkq+1fbOk3n/ZUFeDYL5dUnEmCSdxA/tfMC21qScco2tQW6NqTii2VxxMkozrQ== X-Received: by 2002:a24:4e50:: with SMTP id r77-v6mr3126588ita.6.1528857460941; Tue, 12 Jun 2018 19:37:40 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id z6-v6sm1149417ita.21.2018.06.12.19.37.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:39 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id CBDFB1404EA; Tue, 12 Jun 2018 20:37:38 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:21 -0600 Message-Id: <20180613023728.202173-7-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 06/13] 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 v6: - Warn about building sandbox EFI support on something other than __x86_64__ Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None lib/efi_loader/efi_runtime.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index 65f2bcf140..acda21c91d 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -58,6 +58,18 @@ struct dyn_sym { #define R_ABSOLUTE R_RISCV_64 #define SYM_INDEX 32 #endif + +/* For sandbox we only support 64-bit x86 at present */ +#elif defined(CONFIG_SANDBOX) +/* + * TODO(sjg@chromium.org): Consider providing a way to enable sandbox features + * based on the host architecture + */ +# ifndef __x86_64__ +# warning "sandbox EFI support is only tested on 64-bit x86" +# endif +#define R_RELATIVE 8 +#define R_MASK 0xffffffffULL #else #error Need to add relocation awareness #endif From patchwork Wed Jun 13 02:37: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: 928633 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="W4TmA4M3"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B2m00nbz9s3R for ; Wed, 13 Jun 2018 12:46:07 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B0CF4C21C27; Wed, 13 Jun 2018 02:39:25 +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_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 EF389C21DFB; Wed, 13 Jun 2018 02:38:04 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4CD92C21E1A; Wed, 13 Jun 2018 02:37:47 +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 7A856C21DED for ; Wed, 13 Jun 2018 02:37:43 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id a195-v6so1886438itd.3 for ; Tue, 12 Jun 2018 19:37:43 -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=yyNN+iKb+s1de/y0+iFo51gsepUvnzM5bi3LutvL0ZM=; b=W4TmA4M3w7PSzy94uBi2fEpLPt/1B2vPo1c793AG2K58EqBtK1aapC78aoLMlqcXRG oqJZ9oEUGxypFyNbkarGS74ZUpRdOHoNdZ29pR2QRufLvXqau6Zh6a9dn7W09q6sjOuV OXk6s/DoRepxO2Ye8ncsLF5G5d+o2sDOgNqpmTFjTzZqVxw0AsSoxiyJbogCXWS0izYy TM+uWBBwaDZv85W1ahpz8Ew66FGyDMMZj/p1SfLxMB9JvDQnwUkBxUVe43jQ+BE2K3w8 ZFFG03kpefbjqwh+WNFh8RVznl98aezWUs0XbROCUN7nx1XoMsJzJE/fEBDsNON8dt7d 88QA== 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=yyNN+iKb+s1de/y0+iFo51gsepUvnzM5bi3LutvL0ZM=; b=DdVAuaOQX48COQvuKKfytYgJ1/teQFoUSjGTaAA3xojaOiyBZn/yW7hj6csRwkxehE H0TAlp6HoaDrPAgf8bDIhcHYBt6WU5NopbSVjtcHE5X0bC9I1lQLJZTsiqcRI7EM0LH0 Anqk2tfeDth4ULgEeSYpR4k0ShuVvQmI64OOCOU4VMLoB5FdmcMs2IKQhe7wWoA32TxP X8kMltnyv56cdycBj/ldVvCBWAU8GOg9yML31xK6wEX37ay7P6zIGJwDS8pz12n2y3R1 OD23AL3hL//RZkfbaOMXlJXE3i2meplCf7eZDjuSTly9VL8cWa0Z0R5QgNZtcMvtF9Kj iAMg== X-Gm-Message-State: APt69E3udWxZmSToc9Z8YGv3RrK9PhSewgIKkUVdfJvjX+XtiLBfG2pB n5TU0X5+hXlr8Jng1fwI6FvQ0g== X-Google-Smtp-Source: ADUXVKLgeMmwkFePYfXdLl0ditwC6z+bO2T0UknRIKrB3mJEP/Ww/JAyI2yLhqt5D9I1sblXYcwunA== X-Received: by 2002:a24:2b17:: with SMTP id h23-v6mr3009554ita.103.1528857461945; Tue, 12 Jun 2018 19:37:41 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id w8-v6sm545692iof.84.2018.06.12.19.37.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:40 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 19F3A1416C1; Tue, 12 Jun 2018 20:37:40 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:22 -0600 Message-Id: <20180613023728.202173-8-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 07/13] 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 v6: None Changes in v5: - Drop period after "elf" in comment 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 acda21c91d..388dfb9840 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -28,6 +28,10 @@ static efi_status_t __efi_runtime EFIAPI efi_unimplemented(void); static efi_status_t __efi_runtime EFIAPI efi_device_error(void); static efi_status_t __efi_runtime EFIAPI efi_invalid_parameter(void); +/* + * 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 Jun 13 02:37: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: 928628 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="fvzvoRrQ"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159zl5Z7mz9s1B for ; Wed, 13 Jun 2018 12:43:31 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 84C83C21DB5; Wed, 13 Jun 2018 02:39:41 +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_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 DF14AC21E15; Wed, 13 Jun 2018 02:38:06 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3335CC21E13; Wed, 13 Jun 2018 02:37:48 +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 95370C21E26 for ; Wed, 13 Jun 2018 02:37:44 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id l6-v6so1957131iti.2 for ; Tue, 12 Jun 2018 19:37:44 -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=5wNPsQFwSPxOfiSDCAwTd2zvcSE9Ag+qi0Ei3Qjr+5w=; b=fvzvoRrQ81lu74BPsHhHBCNlg9o2NOl0UJidXQibCnC0Zm2pz+o+CK9ob43+FUZU3t OP1FXyEplkEmQGK1RfYxsJtn5+Bso3C/7o2ft4lH4Wii91qQHI6j11kpAcbdH26Lo86e KfVLTb9cd1IzhLCb3PvsOXNkV+Me7AWZygn3t1lJHYBkxFL+yDgEzDP4a2tKnNmOUESj fes4vJSOh63H8aM9Yn9iZYVA/Fnt19/3N+W2Y9CXAVfjiIyn4eh3fySmE4SG9zPNFYID ykgCKSLvJ3m0kmX286cycZwElc0jj9YSxculuYv/QQPDaGvFRAMbQYKWyhHKcaNO9taU LSDQ== 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=5wNPsQFwSPxOfiSDCAwTd2zvcSE9Ag+qi0Ei3Qjr+5w=; b=Jq/iCirpcxQixJThtJP36ohIss+lZnHIWl2LZxQ2+GnSVPc8OYl7fjJ0nXVjhe+x62 dyolOqemC/LxbYVGawkgob3q8PGwd4Avm1rbQuE1NHPz5WBMKTCsjocya1w1odCpSM5B i+Ea91Og3Sx4DzGpCJbl0MbCfCcfjP5DugJkfcJrVZqmAl14u3sD3eVS9+4AmUAze7A7 LC1rBvU9DgYsxkPo4pw68NDgiTHLsb3IwuEvUapNXTcRKm9K9xc4G28Ki3Qpnik63YFm vZjkS7tBVG06CuNpC1qwYGHtnKfuTi7ps7Kh+YkBwLc11O2GsqgJpxHD2snQe3yVlrIu mCcA== X-Gm-Message-State: APt69E3Cd+cWi3szWxWwGpzd8gBzNr5JSj75MhXUQNzujFtRJSQa10Kp 1AMSngOZscF2m/k1uTIYr6ysKA== X-Google-Smtp-Source: ADUXVKLrvhbfka9iJ6nb319iv2ZKCOSJh5sv7XhuzjpxLbW3JzA0Zlo2eCj5JuF9Kivj4B13BFiaNg== X-Received: by 2002:a24:39d8:: with SMTP id l207-v6mr3151922ita.10.1528857463007; Tue, 12 Jun 2018 19:37:43 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id i189-v6sm1008656itf.22.2018.06.12.19.37.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:42 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 788221404EA; Tue, 12 Jun 2018 20:37:41 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:23 -0600 Message-Id: <20180613023728.202173-9-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 08/13] 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 v6: None Changes in v5: None 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 df58e633d1..d471e6f4a4 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 || RISCV) && OF_LIBFDT + depends on (ARM || X86 || RISCV || 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 Jun 13 02:37: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: 928624 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="d0Z1q54a"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159xK5xGcz9s1B for ; Wed, 13 Jun 2018 12:41:25 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 4DD58C21CB1; Wed, 13 Jun 2018 02:38:50 +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_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 21A77C21D72; Wed, 13 Jun 2018 02:38:02 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9C9DFC21DEC; Wed, 13 Jun 2018 02:37:50 +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 98B61C21D83 for ; Wed, 13 Jun 2018 02:37:46 +0000 (UTC) Received: by mail-it0-f51.google.com with SMTP id v83-v6so1951959itc.3 for ; Tue, 12 Jun 2018 19:37:46 -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=ezMgtiKts2JExp+cMdT75+FoAvPM1fXZ9Ygg6cb/Kmc=; b=d0Z1q54a+VpXcsziJK0KQDm0GhGXjsm6VsVNcb5Q6mljS0N8PAi8V3Ft9m/6+n+z9X o0lOeEztfnOuTvh9i5Kgm4YXmpgYyQ0/b/7TYPTD1GtjUlyIzVWphAPlYSL+FEch/Kht 8bXytIccbButjuER8i3aOziqfM0JHuwtnG11t/kBXOUKkmIxv7FxBPaHUxkHSnormOCw jc6Sa/bhopuDL54yCiHNwRxu6O+N2qkTgWapQ/VX6olP8lF0BYnKQUc1MhCOIwEVlDlT KPICPYkV216//BEHGJbVu5CvDeFAp4vDWAMFeKjVhxQVAPoTHs3L0rtrgRIAgE0t9uDE cOvg== 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=ezMgtiKts2JExp+cMdT75+FoAvPM1fXZ9Ygg6cb/Kmc=; b=Hq3uMaeQYiiYlwLJDad3bKBUwlXENaMgXExHGjL92HF6auSwxhjR4r93RiLxUk4HHe rzMUVuME+nhlZsKMr+ZSwSS1iIRRTJ93F8aF7ii3rtYguulk+bvx4nTMzaKO8ey+bQRo 40aDicORRP9387taBgVINL6a0XBMdzkdnD3O8XWAt6ppEf/T8BOJ80bU9qDTxhVAs7PT sIjM9qv0hzVeJ4UvwMN09Ep81T4SRcmXO6Z0SfXH1ZKVoAi4l/Oq1HA5yqiROhlYuqPm JCvbzqBn2MtBgtQ3AE9GxhFctdLPg2XZ6NxXvr+pCo9yN8rHsAZMcglbBJ2ekBdGhbbW O7Mg== X-Gm-Message-State: APt69E0S9JQ/uf57NWinzkVm28FJCUw7hOBvjMwv6D/t23bLa2aEMyH2 LBWhvnLof+wOpIc4CrLp8iF1ig== X-Google-Smtp-Source: ADUXVKJITb4Bx5m3/QDlqG4tjZwonJA+OkhvVP24Yk25x4BynrL1y7vS6mEWGzrwFl9FT0iTxhceIw== X-Received: by 2002:a24:4516:: with SMTP id y22-v6mr2945782ita.109.1528857464875; Tue, 12 Jun 2018 19:37:44 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id x16-v6sm928413ith.6.2018.06.12.19.37.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:43 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 00E2514153C; Tue, 12 Jun 2018 20:37:42 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:24 -0600 Message-Id: <20180613023728.202173-10-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 09/13] 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 v6: None Changes in v5: - Drop call to efi_init_obj_list() which is now done in do_bootefi() 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 | 87 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 24 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 707d159bac..a9ebde0c75 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -347,6 +347,60 @@ 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) +{ + 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, + (uintptr_t)test_func, + (uintptr_t)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(); + + /* 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; @@ -425,31 +479,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(); - /* 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, "\\selftest", + (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 Jun 13 02:37: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: 928629 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="CmC4C8+m"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B005Lq6z9s1B for ; Wed, 13 Jun 2018 12:43:44 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 5431EC21E2B; Wed, 13 Jun 2018 02:40:33 +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_MSPIKE_H2, 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 04635C21D56; Wed, 13 Jun 2018 02:38:22 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 73692C21E42; Wed, 13 Jun 2018 02:37:53 +0000 (UTC) Received: from mail-io0-f194.google.com (mail-io0-f194.google.com [209.85.223.194]) by lists.denx.de (Postfix) with ESMTPS id A7954C21E36 for ; Wed, 13 Jun 2018 02:37:47 +0000 (UTC) Received: by mail-io0-f194.google.com with SMTP id u4-v6so1812638iof.2 for ; Tue, 12 Jun 2018 19:37: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=vfB1pkREZEA/Om8JqrHCc1vDJxIYZu7rXC6ReWRnaiA=; b=CmC4C8+mzZBB9txHL7dtT8WA8DgC6zrgPhPiRDwHHSw+m7aPrmSYk5kK79pYa2Uk/+ b5BCPDKrewapEAny50EDhh/D50Jqy6lI52OgZBBqox2t3SknIX6U/IFaMlYBL5hsKY36 xB1nGgF0guCoqcjAAtEsRERShl4OEAYzC4gatyxqJKNKYnaklHGMmya0mOmEbohkpcSt rR9+zpmpuQqUa4y1ISasShN5ePj+lQ2v8Ovk5hGz4dF7KH93dnUedFgI6VSH01VuAiyP cpapatnnUPzJDcmDZkpZTFs3zWLTe1xnqMWZuVMPi+yXZ+zanNvz6NQZv69OE/jmo/fl dBGw== 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=vfB1pkREZEA/Om8JqrHCc1vDJxIYZu7rXC6ReWRnaiA=; b=PfokMxcAYr8NnDuvCDjItP7VToelHBLnlNCVmsw+EvxYqBt5tuBq3iIpnoR03dCTzH oYSaiODMx3ntuAM+mGAirYtW/CWuxwTDfyL/CwtSdOnql+U48Cyg3hlFGK9sNOO0KR4c sB4e0sNT5EwHxL0iWfbEY92uCZVaf8csxWMwa7aJAijV2G6YvNJTW4rgD9nOw9TZ6D95 laE+u2ElQZ889LGIAqOuSv32SCDa8RcBHFjTsEIPdlYRfY6yfy2Po+8byoV5E1THHtCg JCLmfu9DVUrQEm28UadhhlFkdX0c5E8s+24MvKZjhq1MqtEEh+fuqZ52yF421RCyCocV hpkA== X-Gm-Message-State: APt69E34QAHSZhduIAiR/ytAqwFF9rRlgu6vHCCceJn78yKexjil4viG FUdp7H60X9L4UVc0aVlVIabdoA== X-Google-Smtp-Source: ADUXVKJpdCTLwfQeIqhi5NACfkoJJUl5M0Zk7F4fQ8ijhcKs7vdt/zjNS3DNWh0MXAK3Qf1diWCTQg== X-Received: by 2002:a6b:82a1:: with SMTP id m33-v6mr3118322ioi.56.1528857465846; Tue, 12 Jun 2018 19:37:45 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id j141-v6sm622868ioe.46.2018.06.12.19.37.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:45 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 1517E1404EA; Tue, 12 Jun 2018 20:37:44 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:25 -0600 Message-Id: <20180613023728.202173-11-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 10/13] 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 WARNING: booting without device tree Hello, world! Test passed Signed-off-by: Simon Glass --- Changes in v6: None Changes in v5: None 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 a9ebde0c75..ac80074bc4 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -347,7 +347,6 @@ exit: return ret; } -#ifdef CONFIG_CMD_BOOTEFI_SELFTEST /** * bootefi_test_prepare() - prepare to run an EFI test * @@ -399,7 +398,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) { @@ -431,8 +429,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; @@ -477,11 +477,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, "\\selftest", (uintptr_t)&efi_selftest)) return CMD_RET_FAILURE; diff --git a/include/efi_loader.h b/include/efi_loader.h index c66252a7dd..0615cfac85 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -442,6 +442,9 @@ efi_status_t EFIAPI efi_set_variable(u16 *variable_name, efi_guid_t *vendor, 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 d471e6f4a4..110dcb23c9 100644 --- a/lib/efi_loader/Kconfig +++ b/lib/efi_loader/Kconfig @@ -25,3 +25,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 c6046e36d2..2da28f9c90 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 0000000000..4b8d49f324 --- /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 Jun 13 02:37: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: 928626 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="Va6HoXN8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159yZ6rMzz9s1B for ; Wed, 13 Jun 2018 12:42:30 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id A699DC21CB6; Wed, 13 Jun 2018 02:41:08 +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_MSPIKE_H2, 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 66015C21E13; Wed, 13 Jun 2018 02:38:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 27EF6C21E26; Wed, 13 Jun 2018 02:37:53 +0000 (UTC) Received: from mail-io0-f171.google.com (mail-io0-f171.google.com [209.85.223.171]) by lists.denx.de (Postfix) with ESMTPS id 78418C21E13 for ; Wed, 13 Jun 2018 02:37:48 +0000 (UTC) Received: by mail-io0-f171.google.com with SMTP id l25-v6so1773631ioh.12 for ; Tue, 12 Jun 2018 19:37: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=moMR90dd/pk2MfuENMstJxor5w3+RwQYwAwWU1/xbs8=; b=Va6HoXN8ieQTe2BnM/rbmx8NnKsEG5GDHt84XDmrwLuOsto7YF4ExYtE2VgaVdtZwA eH3X7hxCFrp9xb0gnQjh0o+ffIOtkMUdx+EdjaYB9qrhhzB42Ee3DIR27WSBGonRHmX8 0v3fD+GdgtmxfhYQFJGuSRLMIQiEghHUCPNvFO7F1DpIknjmsgloTF2A1M9fPx5X8PYl ShXa+mxnLWFcQGtLkr6YC7UvnB2Yhg2Al1c558UqP5GUo5o+lCMjJQeU4I/tQm/3BWtR +kREZBGZevNDbSMSoht1pQU1zvUlcL+garYXVOwYI9ZGBihXfH8ZNtogHzJAC9hjbPwU SAYg== 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=moMR90dd/pk2MfuENMstJxor5w3+RwQYwAwWU1/xbs8=; b=kHqvq3ztVIb03XHOrPihQQP9Xi1SIzssRzbrmTEaRdU7E75V48HBPcOReu19ywOpSb 97jC3wf9rqoYLHmR95Fo0Yxz7ig0Ae0dJfNQM2OnAOadJJZOXtkEIZGSNeS7SjjsdodQ y8nbyz139dCpUwhbySOfmTy+FcPD+Lj8J8x3Xd+Y6N04WBdLUPeSKWI4swnmzsP9bbC9 DqqTFKcDhjc+4ybNfwvLUqKzs7zZUnu67Fn5QBjxQHYETMXcYC7r/8elvmLmnxYJ0n8M spGPPr0vtrO0lznEOIt/YDPMUw57ivTHBtp20rd5VD847aIMOzAUvHd8w/Xt8rAdjSUO tvOA== X-Gm-Message-State: APt69E00GaV/NmdALtEi6MhoUztll3C5FZWSn90PL47Djs0iZ8i9+3Nr jGp86XtFhxaGExUNn69J3MnA4w== X-Google-Smtp-Source: ADUXVKKSxI/8VszYSST6BbLJbC2DB3LmGwDduF9rBfOFqePlql2GZlWDCD6MIhuq8TSgRStJoebf8Q== X-Received: by 2002:a5e:c815:: with SMTP id y21-v6mr2857371iol.263.1528857466778; Tue, 12 Jun 2018 19:37:46 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id f72-v6sm570875iof.14.2018.06.12.19.37.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:46 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 7B24D14153C; Tue, 12 Jun 2018 20:37:45 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:26 -0600 Message-Id: <20180613023728.202173-12-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 11/13] 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 v6: None Changes in v5: - Drop call to efi_init_obj_list() which is now done in do_bootefi() - Introduce load_options_path to specifyc U-Boot env var for load_options_path 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 | 79 ++++++++++++++++++++++++++++----------------------- 1 file changed, 43 insertions(+), 36 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index ac80074bc4..b9eb04531b 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -253,6 +253,26 @@ 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 *load_options_path, + struct efi_device_path *device_path, + struct efi_device_path *image_path) +{ + efi_setup_loaded_image(image, 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(); + + /* Transfer environment variable as load options */ + set_load_options(image, load_options_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. @@ -261,8 +281,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; @@ -283,19 +303,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); + ret = bootefi_run_prepare(&image, &obj, "bootargs", device_path, + image_path); + 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(&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; @@ -303,10 +317,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: */ @@ -316,8 +330,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; } @@ -329,7 +343,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); @@ -338,11 +352,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; } @@ -358,11 +372,13 @@ exit: * @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 + * @load_options_path: U-Boot environment variable to use as load options * @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) + const char *path, ulong test_func, + const char *load_options_path) { memset(image, '\0', sizeof(*image)); memset(obj, '\0', sizeof(*obj)); @@ -371,18 +387,8 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, (uintptr_t)test_func, (uintptr_t)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(); - - /* Transfer environment variable efi_selftest as load options */ - set_load_options(image, "efi_selftest"); - - return 0; + return bootefi_run_prepare(image, obj, load_options_path, + bootefi_device_path, bootefi_image_path); } /** @@ -481,7 +487,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) int ret; if (bootefi_test_prepare(&image, &obj, "\\test", - (ulong)&efi_test)) + (ulong)&efi_test, "efi_test")) return CMD_RET_FAILURE; ret = efi_test(&image, &systab); @@ -497,7 +503,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) #ifdef CONFIG_CMD_BOOTEFI_SELFTEST if (!strcmp(argv[1], "selftest")) { if (bootefi_test_prepare(&image, &obj, "\\selftest", - (uintptr_t)&efi_selftest)) + (uintptr_t)&efi_selftest, + "efi_selftest")) return CMD_RET_FAILURE; /* Execute the test */ From patchwork Wed Jun 13 02:37: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: 928631 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="RRNDAxm8"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 415B0s6Rgxz9s1B for ; Wed, 13 Jun 2018 12:44:29 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 9CA6CC21E38; Wed, 13 Jun 2018 02:41:26 +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_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 B28F4C21E34; Wed, 13 Jun 2018 02:39:03 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id EC498C21DEC; Wed, 13 Jun 2018 02:37:53 +0000 (UTC) Received: from mail-it0-f66.google.com (mail-it0-f66.google.com [209.85.214.66]) by lists.denx.de (Postfix) with ESMTPS id 7F32EC21E1E for ; Wed, 13 Jun 2018 02:37:49 +0000 (UTC) Received: by mail-it0-f66.google.com with SMTP id 188-v6so1927987ita.5 for ; Tue, 12 Jun 2018 19:37: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=aJ9xhhInu6rj6jXjJM91FBb2ByY5EYOPx4uHJ/euGa0=; b=RRNDAxm8GyYOlbsu8Jph+3JtLGOMAVB1vkSG9E6UynkpSEl+absTQ6CzJct5mz83Bo IFqy10rsF3V2+0fkYYEI0PR6epTaubnuoWR5cWxIRFwSixWiyX9gVFd+cwkFD0+sSUHl 6OUv3QmNKoyQkofpCNVJe8YFnxQ/vsiaJTx1IKM4MsLL/yFe8/MNGG9Zs+vlBPv89fGh +32wIeLWXdpiJLACYvMOYtJ+l65cPRiaAr+9OXPbYYDXY8jxNV+KSlaMBhLwTihjaAL4 U+kan7S3Be4lRdfdR99rXt7YSxO8g+UNYIsg8D5bpoUCanyIitmPzpP48t4RNA8VKP+l 9X4Q== 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=aJ9xhhInu6rj6jXjJM91FBb2ByY5EYOPx4uHJ/euGa0=; b=pjzZQ9zeuJs6nkcfgxpJDsGeFGeVoJAnWPsSiXpbtsYWOyPaPlmTqDt9vJT1dhacxs 7xyGOLhp6X3PTS2OMKgoXrj8BvKkBJkY1ldrBHZATrM7SBe7S54rXETZzlRvs8xmFCic lJgteZqKQLi449FVff7JgBCfdHiR3QQzF/lhdo7FxorAH8oG3kPEqQCoeN/w4xzGUfXz xcUlJ4e90FIIZpjjb7uL7UhJJ7m5qLIb+U8pRCqN2Etx0z4FTeAGv1MkqPLvktkyjcYN PwW4hj/IbTvb2z5monlDsBvilxhoOcS0qgyFKOYbW1ZutLkiBzJiiri4m68Foo3+vuil A3zw== X-Gm-Message-State: APt69E1bl4vvh+DgGJSKkR25bVnn4XnO6VBBlnuRYhoeRJBoKxrMj/BD ZPn7KWU7LTDiOxM7B2i8EqXhrw== X-Google-Smtp-Source: ADUXVKJaDu7x/f/WF3Neh3+7pJXtvAnJuY+q6bNqLlCNIL0MoQCoHaPpP9WPfQMLYyeNOC59mFuvCA== X-Received: by 2002:a24:53c1:: with SMTP id n184-v6mr2991054itb.25.1528857467835; Tue, 12 Jun 2018 19:37:47 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([100.67.80.24]) by smtp.gmail.com with ESMTPSA id d13-v6sm955719itj.30.2018.06.12.19.37.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:47 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id A2AED1404EA; Tue, 12 Jun 2018 20:37:46 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:27 -0600 Message-Id: <20180613023728.202173-13-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 12/13] 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 v6: None Changes in v5: - Rebase to master 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 b9eb04531b..7a98c9a6bb 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -273,6 +273,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. @@ -355,8 +369,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; } @@ -391,20 +404,6 @@ static efi_status_t bootefi_test_prepare(struct efi_loaded_image *image, bootefi_device_path, 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; @@ -491,7 +490,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; @@ -509,7 +508,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 From patchwork Wed Jun 13 02:37: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: 928625 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=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="YvXq26iG"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 4159xj5yr4z9s1B for ; Wed, 13 Jun 2018 12:41:45 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 721E5C21E12; Wed, 13 Jun 2018 02:40:51 +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_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 E068BC21E2B; Wed, 13 Jun 2018 02:38:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 23C06C21CB6; Wed, 13 Jun 2018 02:37:54 +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 CA829C21E1B for ; Wed, 13 Jun 2018 02:37:50 +0000 (UTC) Received: by mail-it0-f65.google.com with SMTP id a3-v6so1976463itd.0 for ; Tue, 12 Jun 2018 19:37:50 -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=6uA8Y1U/KtxKKJRxVO6cpTcPXIli2FJOlBGbcOiI9Fk=; b=YvXq26iGNn7YbWY9glk2S110c/UPwdEjry4wO9tqlT+4pEVpW8C/BBPzlEsABTTXi9 ae1kQVzE/MKOpcOx7wnMNTIG+EyZBuwZ3CIoFzIXlYO68Ct0aXR4MvUrF6ChX5X2wb+H EH/rs/+c/cHnvyKUAijOPoV9V/CsRt9ZVsvjv2l6TAjEmU+TUtn3BSQa5jgpr/7adXV5 FnwQET1lquyhUntJrYJ58EuijoQJyl/E/+yDdatKj/MGMPPzOfkw9SP2XMbp+4FLDPuk lnQ2IsEY7F9tT0zZw0GH9zJGIvo2TcGeiaUsIMtoNry/ZMmYZsz9+5AMb2nn19KS7uxe pqvA== 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=6uA8Y1U/KtxKKJRxVO6cpTcPXIli2FJOlBGbcOiI9Fk=; b=dhFndEHQ0eGrwespMEcKr/Lb787ZeTlKkAjT2FUBvHfi9SCXFtLro0X5isHaE/pzcf NGXnA0p8vwLP3Z/wvnctTyTKtZwnZLGhA+3MD+wyNlsucggznxYKE+08zXWuizOIe1fa ybJdORbwIj1wM+Fu9AVJZcfz3VZP5wG5XqskL/VDow0Dz6diJ6Z9QUhbSif/4NnRMfpl s5mDVuE8uRyDnOVP4CH9R6LDnoQFyVV7qfkoxBUF9/nKxoJvBzEvzAi7q+udLPfwAL75 Wszgt6ekNYzEIElza4JVqmF2w75i3Rm/fO1+mt6CYkbX5KwPfeE/UCRkycjjGvgF4tYi sfhg== X-Gm-Message-State: APt69E3qGlk73GxG1tLfqcYrhhOcWyRzJvzwk4clh8FkoPZiD0tH5zMW ZnRyOdMB196ONNoW+NgXmniFmA== X-Google-Smtp-Source: ADUXVKI/XWJQSbgiyWKoumMXMZHyz9rpt4L3iVDcPsaig1qZSpXRluq/v/JLkZroOBPf0bBJojHW+A== X-Received: by 2002:a24:1cc8:: with SMTP id c191-v6mr3035172itc.139.1528857469034; Tue, 12 Jun 2018 19:37:49 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id w8-v6sm545795iof.84.2018.06.12.19.37.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 19:37:48 -0700 (PDT) Received: by kiwi.bld.corp.google.com (Postfix, from userid 121222) id 064FF1404EA; Tue, 12 Jun 2018 20:37:48 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Tue, 12 Jun 2018 20:37:28 -0600 Message-Id: <20180613023728.202173-14-sjg@chromium.org> X-Mailer: git-send-email 2.18.0.rc1.244.gcf134e6275-goog In-Reply-To: <20180613023728.202173-1-sjg@chromium.org> References: <20180613023728.202173-1-sjg@chromium.org> Cc: Andy Shevchenko , Heinrich Schuchardt , Alexander Graf Subject: [U-Boot] [PATCH v6 13/13] Revert "buildman: Extract environment as part of each build" 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 reverts commit 0ddc510ea37aa578b8cb197840a5125409978bec. Signed-off-by: Simon Glass --- Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None tools/buildman/builderthread.py | 10 ---------- tools/buildman/func_test.py | 5 ----- 2 files changed, 15 deletions(-) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index c84ba6acf1..0efe80d945 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -351,16 +351,6 @@ class BuilderThread(threading.Thread): lines.append(size_result.stdout.splitlines()[1] + ' ' + rodata_size) - # Extract the environment from U-Boot and dump it out - cmd = ['%sobjcopy' % self.toolchain.cross, '-O', 'binary', - '-j', '.rodata.default_environment', - 'env/built-in.o', 'uboot.env'] - command.RunPipe([cmd], capture=True, - capture_stderr=True, cwd=result.out_dir, - raise_on_error=False, env=env) - ubootenv = os.path.join(result.out_dir, 'uboot.env') - self.CopyFiles(result.out_dir, build_dir, '', ['uboot.env']) - # Write out the image sizes file. This is similar to the output # of binutil's 'size' utility, but it omits the header line and # adds an additional hex value at the end of each line for the diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 363db9d8ce..9206fb299d 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -327,9 +327,6 @@ class TestFunctional(unittest.TestCase): def _HandleCommandObjdump(self, args): return command.CommandResult(return_code=0) - def _HandleCommandObjcopy(self, args): - return command.CommandResult(return_code=0) - def _HandleCommandSize(self, args): return command.CommandResult(return_code=0) @@ -362,8 +359,6 @@ class TestFunctional(unittest.TestCase): return self._HandleCommandNm(args) elif cmd.endswith('objdump'): return self._HandleCommandObjdump(args) - elif cmd.endswith('objcopy'): - return self._HandleCommandObjcopy(args) elif cmd.endswith( 'size'): return self._HandleCommandSize(args)