From patchwork Thu Jun 14 18:22:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138609 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2455868lji; Thu, 14 Jun 2018 11:28:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL5Ovu7iFCpuqs8pC5Wnwm3QBEs0AxONbxhRrHoUo+DXY/rhvxCPx8lwtHXoZsqFM9FYpKU X-Received: by 2002:a50:e0c4:: with SMTP id j4-v6mr3588363edl.198.1529000887539; Thu, 14 Jun 2018 11:28:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000887; cv=none; d=google.com; s=arc-20160816; b=E2lDG84GbQbFLW91/mgJLC6kp4Ti4miId+nOH71wgvFmkg0cEKVc76F0EvApEusrh6 Fy1jhMAze02cBdH2pd0cgjGR73YgQLZhRy9OlBvv2VBReZV3FkzEyge4yzdLAtsAJuwm tD+XX3NL00aRtd+XQOA+uL/I42l2nValAzs1INSn2P5F6cmisjhGsOKrON7k2mUeF8Ff plNrm3jQDPZYtq7kZ2SrgRsrhn09HgD2UGQ03LRazvL57oykgBi5yL76LtI6cnUaI1mx uysfuT6l2nufdqo9y+tPgr/2CZ5UDxh5TTllFZvyCexokBNHl/9nyhdovilX5sy9SZlI BYIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=j0UsDECa98ZO9D8rx5HlV2PNXL6+50mB7kBR/pzZJk8=; b=mty9RK1oxYLtBig3s4u1S1SDA2HYUUeMreEWiAMSBxb4Rw0EhloetvQYaJlxDCUudF SAuHdMvMJKgDhVsQdvtlbzn0HF510OAsVcmPiKoUdJLhmEVm7BO0DTj3prpQvwDFGICf ih/5iPyxEvNaxFq2ekDmvgRn95r3NcAU+ikIweOxdLhLluy3tnO9ejjrGC5KiXaLj/Ue NkT3q4LElA+3o/EIly4tgYeivqBLw3h1FKAEZV1KWg4LMLu1jdgNGyazHp4Mo2A9/set D5T9khchtFkv2ZajuMbM/k5k9zpxKHbtZwnjw+7JiYZhpLZ1xf9IAq8c7ktZzW+oQFFK 335Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id h8-v6si656386eda.272.2018.06.14.11.28.07; Thu, 14 Jun 2018 11:28:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 258A8C21D9A; Thu, 14 Jun 2018 18:24:24 +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=none 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 DE192C21E2B; Thu, 14 Jun 2018 18:22:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 101E9C21C27; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 57522C21CB6 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92E8BAFAA; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:22 +0200 Message-Id: <20180614182232.78201-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 01/11] 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" From: Simon Glass With sandbox these values depend on the host system. Let's assume that it is x86_64 for now. Signed-off-by: Simon Glass Signed-off-by: Alexander Graf --- 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 Thu Jun 14 18:22:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138611 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2456247lji; Thu, 14 Jun 2018 11:28:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK7C5q/0XG6KWmyaRNTldGZFXf/SnuZfC8fZxVW0HDyW7IMkClGz4orx3kTz2bychK+xtuy X-Received: by 2002:a50:a5ec:: with SMTP id b41-v6mr3515310edc.147.1529000910126; Thu, 14 Jun 2018 11:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000910; cv=none; d=google.com; s=arc-20160816; b=iIdHfLamAdouC89BqNL1GvqgeE6sKXPbuxoxQhT+6H5Ww+dAgsEtk2jRUcRqeRFRuZ oJiawDBeCiAKHLAePbUl4Xk0ehyd64MShXjwPP5e+Gd9oQ6/TRtKliKIgL0jONA+GqRG NX8Er5Jbm7tzZLswTYYcjQ8Msy0yd3hbF4Lzz+TxkPvQC/59TC3pHY6syM5t7jiVO+VJ 2B9sD4b/gzX+CSsX8slC6xONlGEiXYXmPDR8m4jFSL7ucx2R86aykEuLY7w90IFiEOUM Ly5FeDhV0Z781yE5j4beXbqV1xa0OmNbVQQBXokBnzjtJSL2TXojNgUADycBsnnXtVvI RN6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=97sDLf9D+o4CHkrAB/PKmm4T2GTnP3HHG/6/Xqm11Qo=; b=OI4WGlWuYo9oeCu68iYJ6S3AvEq+xMT2MLl9QS8+qgOT3MaMrKf8U57kVNWWzU1tPK cUC7zpUbtkTxSd/V2Not84ILRhO8W7wslSaZfaLqciPm5PTifL56a1Zk3OrxsWk+Eh9M i1BVr5ET4RujbD0kXRHWAMIBiBpQ8FKEea9ySh33qN0EJbC32/gmXm0+BSY/iG4t3hHa MdkgBENPdrj9wKMd1TpvNQZCu8vsK3c+5A3pVXC0MnDdWBrcdWJZiKJyOPoQE+/tE5eU KnNagus5xyjOgTZUeiMNrmk6hNrXvcbvyMINOBb7Bdx+eLng41sVkOc8tvS+TB9o4MVT lQSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id 21-v6si4700217edx.293.2018.06.14.11.28.29; Thu, 14 Jun 2018 11:28:30 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id AF12AC21D8E; Thu, 14 Jun 2018 18:25:11 +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=none 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 34BE2C21D8E; Thu, 14 Jun 2018 18:22:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 4DA24C21C27; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 60094C21DA2 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9530BAFAF; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:23 +0200 Message-Id: <20180614182232.78201-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 02/11] 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" From: Simon Glass 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 Signed-off-by: Alexander Graf --- 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 4874eb602f..388dfb9840 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -62,6 +62,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 Thu Jun 14 18:22:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138603 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2452003lji; Thu, 14 Jun 2018 11:23:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIW1DSqsEu0HwMz4fhaYFZNrnfovSF96obactoYGew3ZDhVEj5KFXDGrQXlxBoKt4Bm5Lci X-Received: by 2002:a50:ce03:: with SMTP id y3-v6mr3495013edi.300.1529000631357; Thu, 14 Jun 2018 11:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000631; cv=none; d=google.com; s=arc-20160816; b=pxteAYA640IzERP0hKfsJ0bq8gOJxUcuX5/ePU7oiIy66jqVwQZJSFADQ2qziTdc47 BpV3K5HPPu3dLwqVy9tknJKndYd7vnKdZ41ssaKWXumPUjbHuJQuG5npeW2mBf7hUQEj 6W8vYnlmGeUjb3hUP/Kg3I4b0eLVS/+0X/zwXG9tT+R4p/JiFqa//hh4HVa4vKFdUMXR fdMZF3M92M1huPOM5e7IGTfH9Q5lN23r63U78qLjqE740qngj0cP5Av97I8Xe+CY+60L 8mG4jMnRswmZbLzf5a6R1T8ZAfL8p+HNaXhzy5VM7uLXSkFPHVE9EcmeISNz+uueA32I Vz+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=73m/NCdF9/Nr1lITe5I0+h+ywV5cqcdYnp+RAcAenII=; b=hLADVp5gY4I5s7N/tHIxKRdwxCkdOm9UhFzx3SaMdAobC1Jyw910YepUjvoSoZO9Tc KmdSJelNoAoskiLKxPF6eS3nwtQd7dm81hZKQ5LExQgoXdLI1lgjjDAbuYZIC/oZa0+N uJROcX5ixVxGepS9QZOQ1zy/q9hYwgYykordpJPo6sPshql0izhLUgLrS9z+iOZ8PvYU DS0xd8qqujk+RlzCC+O15EYlDyJ6LpLDXJ2wXG9EaoE44z35+kPJyjlQSXtPcVVD64fx wRJHx9CLh/eU0hz3ZwwGp4jmSpIfJh0WZrL4U3XjHIYjDzTPgV+bYKdBQc7VhRSxzTwX dp7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id u1-v6si3806706edo.45.2018.06.14.11.23.50; Thu, 14 Jun 2018 11:23:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id B5266C21C2C; Thu, 14 Jun 2018 18:23: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=none 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 95EBAC21DE8; Thu, 14 Jun 2018 18:22:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 9D590C21C29; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 43F67C21C2C for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9724DAFB0; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:24 +0200 Message-Id: <20180614182232.78201-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 03/11] efi_loader: Use compiler constants for image loader 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 image loader tries to determine which target architecture we're working with to only load PE binaries that match. So far this has worked based on CONFIG defines, because the target CPU was always indicated by a config define. With sandbox however, this is not longer true as all sandbox targets only encompass a single CONFIG option and so we need to use compiler defines to determine the CPU architecture. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_image_loader.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/efi_loader/efi_image_loader.c b/lib/efi_loader/efi_image_loader.c index ecdb77e5b6..fdf40a62c8 100644 --- a/lib/efi_loader/efi_image_loader.c +++ b/lib/efi_loader/efi_image_loader.c @@ -19,25 +19,25 @@ const efi_guid_t efi_simple_file_system_protocol_guid = const efi_guid_t efi_file_info_guid = EFI_FILE_INFO_GUID; static int machines[] = { -#if defined(CONFIG_ARM64) +#if defined(__aarch64__) IMAGE_FILE_MACHINE_ARM64, -#elif defined(CONFIG_ARM) +#elif defined(__arm__) IMAGE_FILE_MACHINE_ARM, IMAGE_FILE_MACHINE_THUMB, IMAGE_FILE_MACHINE_ARMNT, #endif -#if defined(CONFIG_X86_64) +#if defined(__x86_64__) IMAGE_FILE_MACHINE_AMD64, -#elif defined(CONFIG_X86) +#elif defined(__i386__) IMAGE_FILE_MACHINE_I386, #endif -#if defined(CONFIG_CPU_RISCV_32) +#if defined(__riscv) && (__riscv_xlen == 32) IMAGE_FILE_MACHINE_RISCV32, #endif -#if defined(CONFIG_CPU_RISCV_64) +#if defined(__riscv) && (__riscv_xlen == 64) IMAGE_FILE_MACHINE_RISCV64, #endif 0 }; From patchwork Thu Jun 14 18:22:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138612 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2457355lji; Thu, 14 Jun 2018 11:29:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLP0aAgZb/Lwl8dgDqyHeQ5di+v8VlTlxnhjRIVJPG9t0Wpe+RwG+ihWrXxIx/s8db8QrSc X-Received: by 2002:a50:b8c4:: with SMTP id l62-v6mr3485151ede.80.1529000978659; Thu, 14 Jun 2018 11:29:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000978; cv=none; d=google.com; s=arc-20160816; b=gFoAPqFIoiSDywbnD05qhDkb4i6S+OZLmXOCuY2YdzYmBN4VkzipcFKbpg9AGReH3h Unt8of9zVZpq6j/fOOSlogXYzjQ8HFdXqbgDNdXurOMRqJSMuCPBfQyrEeCDTYppLRF1 6ljbjWIzwsl9EQt3nIncv7OA64t3ZxmV72sMm00onuPxP+D10xLgk+U00zW7bZ1xQRnS ppXJQGglhcQbSRO3wHvj6EWhdAVJSR+nahKV4p91SPwb/oGAQfg70LuwOvWcD2exdOto vMsw/Hhzcw7kJPShcyncxVFAsvnafYqEycSavGepXqPYOKtPmqMEJ837Q+hVu0sN4UmM 1+qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=3a0SinchE6HZI9NjrARcvXPUXR4kJxNpH5NszUO53w0=; b=MfYPDG58RRQ+IiOsN6BI0K+u9oBpkhFsYIOtjyd5xtmu+0nRNV9Y9Nf3YO9qHiIOIu XWZk+4/duDeXLj3/vlOoWNfNTXcDCvGN4lXk0ydG3yq8a6RI4La2yOeEtNEaray8cW8x QERcO0OijQika0A5ahDfK7L8mRyp7exiAWNxArhWEzA6F8fvsMw48j69c0/oCXznq0x4 DfrV8gJRMdCp+MGBqNcjQRzKtfEi+Ie61rpTNiMAnsflTfjr0EQo/65KuVAWKffFB2aC +T5mEoPOux1qT13Jkh/GDRQCZFwOn6iP7lNF9tzz3ymvNHW3TBZY/fbm755/IALldc5z PYfg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id t25-v6si3718810edf.80.2018.06.14.11.29.38; Thu, 14 Jun 2018 11:29:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 3CF07C21DD9; Thu, 14 Jun 2018 18:25: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=none 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 56E2AC21E3E; Thu, 14 Jun 2018 18:22:47 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 63A50C21C2C; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 5DC45C21D8A for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 92DD7AF26; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:25 +0200 Message-Id: <20180614182232.78201-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 04/11] efi_loader: Use map_sysmem() in bootefi 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" The bootefi command gets a few addresses as values passed in. In sandbox, these values are in U-Boot address space, so we need to make sure we explicitly call map_sysmem() on them to be able to access them. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- cmd/bootefi.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index f55a40dc84..a86a2bd4a9 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -389,7 +390,8 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) unsigned long addr; char *saddr; efi_status_t r; - void *fdt_addr; + unsigned long fdt_addr; + void *fdt; /* Allow unaligned memory access */ allow_unaligned(); @@ -406,11 +408,12 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) return CMD_RET_USAGE; if (argc > 2) { - fdt_addr = (void *)simple_strtoul(argv[2], NULL, 16); + fdt_addr = simple_strtoul(argv[2], NULL, 16); if (!fdt_addr && *argv[2] != '0') return CMD_RET_USAGE; /* Install device tree */ - r = efi_install_fdt(fdt_addr); + fdt = map_sysmem(fdt_addr, 0); + r = efi_install_fdt(fdt); if (r != EFI_SUCCESS) { printf("ERROR: failed to install device tree\n"); return CMD_RET_FAILURE; @@ -429,7 +432,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) addr = simple_strtoul(saddr, NULL, 16); else addr = CONFIG_SYS_LOAD_ADDR; - memcpy((char *)addr, __efi_helloworld_begin, size); + memcpy(map_sysmem(addr, size), __efi_helloworld_begin, size); } else #endif #ifdef CONFIG_CMD_BOOTEFI_SELFTEST @@ -475,7 +478,7 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } printf("## Starting EFI application at %08lx ...\n", addr); - r = do_bootefi_exec((void *)addr, bootefi_device_path, + r = do_bootefi_exec(map_sysmem(addr, 0), bootefi_device_path, bootefi_image_path); printf("## Application terminated, r = %lu\n", r & ~EFI_ERROR_MASK); From patchwork Thu Jun 14 18:22:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138602 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2451742lji; Thu, 14 Jun 2018 11:23:36 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLB8z7YKYeujJzvZ6lYUxOnFnuxAtsm52s8DaOb3LwnHjp0DlEIWo6rKZaue5SPELtcYfst X-Received: by 2002:a50:9434:: with SMTP id p49-v6mr3554189eda.107.1529000615972; Thu, 14 Jun 2018 11:23:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000615; cv=none; d=google.com; s=arc-20160816; b=rU1MVLWYzQ4gq8UQJjI4VR6UIEtj/VWr0bFJiOUmv5dzruYPd+E2xFlax17/WlUhGv qPMDXhckItKfeiINEWfxt5G0LUIzkw+H6hOVUtraMGkwGb6FSjCGMElWBWcsn0ogC5Ht fJMyPg3HCt19VLaBlsm9h60yDLTTPxdgosC65RfDO5mVPfhrFaJNLqDays9KCdFgIhwc KkbiZJMiw7vtyeYAXs9BqeRQCeFvfsNr05mOX8+oECLK5wRQ7j2D7AH4KONzMEE1TWzD rrL8OeuC4gykWMs5U6gs9NDyuoH86g6QxIMqBBElnft+0EkoCuqT5lepinV5Rz0HP2bN tTvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=4yVe3Qhep2FECKHeBfXJoPFMHyd1p29AD7UN+bxkh04=; b=TgBaVBPzF3jWAXzLgkvW3zQEpOdfyfBuFQtwX4E1po4X5MhfqsBSLB/bE8Ht4CbZuM o3sc8pvmJuCj00qnSPzy4WNmfVHORZJZlcrjmHDvVEn4a8E1HabQeJxk77udzcuXu1hk dIUGwAQCc2Yo5M0XUWz/cMIIobPhcQKDqtEHeqayf/6W2NihT6k6jz5wLd0g1A1liws8 t+qAF9RCPEQg8xFSvUqu/TtpY7XAvbBHchVTbpNWLkQb8f9rETs7lPt3riXg6rTLUNXo xI3kBU8Gt7aNpzSHvct+NQ+EH1NeO5YG+sXjQgc+Opc9EZ3nj+h4KsIYiv6SvLh84RxE CRiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id k8-v6si627189edd.246.2018.06.14.11.23.35; Thu, 14 Jun 2018 11:23:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 7E795C21BE5; Thu, 14 Jun 2018 18:22:59 +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=none 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 CBF2BC21DD9; Thu, 14 Jun 2018 18:22:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 89BEFC21DB5; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 34AF4C21C29 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A67C6AFB4; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:26 +0200 Message-Id: <20180614182232.78201-6-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 05/11] efi.h: Do not use config options 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" Currently efi.h determines a few bits of its environment according to config options. This falls apart with the efi stub support which may result in efi.h getting pulled into the stub as well as real U-Boot code. In that case, one may be 32bit while the other one is 64bit. This patch changes the conditionals to use compiler provided defines instead. That way we always adhere to the build environment we're in and the definitions adjust automatically. Signed-off-by: Alexander Graf Reviewed-by: Bin Meng Tested-by: Bin Meng Signed-off-by: Bin Meng --- include/efi.h | 17 ++++------------- lib/efi/Makefile | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/include/efi.h b/include/efi.h index e30a3c51c6..826d484977 100644 --- a/include/efi.h +++ b/include/efi.h @@ -19,12 +19,12 @@ #include #include -#if CONFIG_EFI_STUB_64BIT || (!defined(CONFIG_EFI_STUB) && defined(__x86_64__)) -/* EFI uses the Microsoft ABI which is not the default for GCC */ +/* EFI on x86_64 uses the Microsoft ABI which is not the default for GCC */ +#ifdef __x86_64__ #define EFIAPI __attribute__((ms_abi)) #else #define EFIAPI asmlinkage -#endif +#endif /* __x86_64__ */ struct efi_device_path; @@ -32,16 +32,7 @@ typedef struct { u8 b[16]; } efi_guid_t; -#define EFI_BITS_PER_LONG BITS_PER_LONG - -/* - * With 64-bit EFI stub, EFI_BITS_PER_LONG has to be 64. EFI_STUB is set - * in lib/efi/Makefile, when building the stub. - */ -#if defined(CONFIG_EFI_STUB_64BIT) && defined(EFI_STUB) -#undef EFI_BITS_PER_LONG -#define EFI_BITS_PER_LONG 64 -#endif +#define EFI_BITS_PER_LONG (sizeof(long) * 8) /* Bit mask for EFI status code with error */ #define EFI_ERROR_MASK (1UL << (EFI_BITS_PER_LONG - 1)) diff --git a/lib/efi/Makefile b/lib/efi/Makefile index 18d081ac46..ece7907227 100644 --- a/lib/efi/Makefile +++ b/lib/efi/Makefile @@ -7,9 +7,9 @@ obj-$(CONFIG_EFI_STUB) += efi_info.o CFLAGS_REMOVE_efi_stub.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi_stub.o := -fpic -fshort-wchar -DEFI_STUB +CFLAGS_efi_stub.o := -fpic -fshort-wchar CFLAGS_REMOVE_efi.o := -mregparm=3 \ $(if $(CONFIG_EFI_STUB_64BIT),-march=i386 -m32) -CFLAGS_efi.o := -fpic -fshort-wchar -DEFI_STUB +CFLAGS_efi.o := -fpic -fshort-wchar extra-$(CONFIG_EFI_STUB) += efi_stub.o efi.o From patchwork Thu Jun 14 18:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138601 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2450955lji; Thu, 14 Jun 2018 11:22:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVavGXOzwgLB0TmKg5bnXMP1qgllvF+YotnhK2v1UIgoFq6u65lBkyO1f4xDRfwFTpQf9f X-Received: by 2002:a50:a0a7:: with SMTP id 36-v6mr3506161edo.258.1529000561195; Thu, 14 Jun 2018 11:22:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000561; cv=none; d=google.com; s=arc-20160816; b=bwrTg+6Rm7kyn3v6LZ2HqP2KrJXs1qe2iEZCJfeuGgwUm7yvXp1xbkaM46asvKnsA6 LLb3lz1vuqiVag1N36iPCc3b7zn8jyHK6ofdULTOaEDOqN7CBl+dAVQ3JyAbiniJp7q0 GlJx6ewUBje6NWhdk7nVaQa2BfL4yBTdeCRZsmXNnQaMzdKYl/LFkvbfdtcLOkV3Tn3N qug5vDVJ7cEjqu+Ex9nt10HYS/7vfCKstJjuAH0Q/jh0zAmG5QRJ96rzyJIDqgVNsxoN Qjzz1n2W9w6VyCOmXCvQ08O+sGmrz1hsGWvg8YzaCaLwQMfcLk+txoe1YuCff2AsksOi hsBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=YdXjBEeCo2jVBjedPIAZnNd95MPouVnNFn/qHEnIfnQ=; b=RlF+jt67ow/jqPEXDmKd56wemk7qBje17l1GPYKcShVYRz6OQDLCjxZAHJ0hqnhkAI QTt771uf1mgpj2z0Kf459D3MLE957wj/OR7gj9VVrctj/u//j3UH7w+3LCHMZ1Hj/tKs 61WP8zyAzbEjW7gBAsfwAz/0CjUNyUUN+oA5rMK/Bxozs02ug5wd8Y3iQR+hz/fJlHe2 8VipP5CYKnsxsr/Woc1i5QpvtxZCubIGzZAcnqjdEk8tRe0BpATZalGdQmvYnjB2WiWn FnSAywm7Pj5HQ3I72JJYsQp8xgkTfHi39Zl6L1M6V9ZkslZMKnCjScaePNPQQ0SXOq7x vktQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id m10-v6si4537079edp.378.2018.06.14.11.22.40; Thu, 14 Jun 2018 11:22:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id CF735C21DC1; Thu, 14 Jun 2018 18:22: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=none 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 0D593C21C29; Thu, 14 Jun 2018 18:22:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6EC8EC21DB3; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 0F3A7C21C27 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A0321AFB2; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:27 +0200 Message-Id: <20180614182232.78201-7-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 06/11] efi_loader: Allow SMBIOS tables in highmem 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 try hard to make sure that SMBIOS tables live in the lower 32bit. However, when we can not find any space at all there, we should not error out but instead just fall back to map them in the full address space instead. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_smbios.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c index 7c3fc8af0b..932f7582ec 100644 --- a/lib/efi_loader/efi_smbios.c +++ b/lib/efi_loader/efi_smbios.c @@ -26,8 +26,15 @@ efi_status_t efi_smbios_register(void) /* Reserve 4kiB page for SMBIOS */ ret = efi_allocate_pages(EFI_ALLOCATE_MAX_ADDRESS, EFI_RUNTIME_SERVICES_DATA, 1, &dmi); - if (ret != EFI_SUCCESS) - return ret; + + if (ret != EFI_SUCCESS) { + /* Could not find space in lowmem, use highmem instead */ + ret = efi_allocate_pages(EFI_ALLOCATE_ANY_PAGES, + EFI_RUNTIME_SERVICES_DATA, 1, &dmi); + + if (ret != EFI_SUCCESS) + return ret; + } /* * Generate SMBIOS tables - we know that efi_allocate_pages() returns From patchwork Thu Jun 14 18:22:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138610 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2456202lji; Thu, 14 Jun 2018 11:28:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI5g6BctW6mWCTS+cCu35CDs4VapQPoh+Q+6NrliYEGy4Rc8AP60hOfiUfG0a2aC71LAQz3 X-Received: by 2002:a50:d751:: with SMTP id i17-v6mr3625065edj.260.1529000908228; Thu, 14 Jun 2018 11:28:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000908; cv=none; d=google.com; s=arc-20160816; b=d6gBsQ0u+xuDLXmkOHcrdV7JnCWkS3P6kP9jWeef3Q4MzrNUfaG6cXZehB+PEpawyd Mp+kt6pU253rTA/QAT/rzXnmVBYBl+D3peABHhXQ4Bb/C9Tw1k1aG6kTAe95hYVKuRF9 UR+1L/YpzAfXo71ziA55ORdgPU6qwd7cfAJ0aysTzxE4JT2O7Ic0G9gMAOzOnLcEtajs dRSvF+m9dg0EJ7Nk70kvGVGUMFGxkgPo5pAB/jxSEDBLyPqLU3iZIhOUplaEgK/HMCYo VwbGoiqv15WyfXxH3+OpkN7pCdojb8tORwMbhFZo66sQV18zwcFexd/3C6/pgskoqyjW WfWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=CvRrI0zXDXVvVSkHEV4+LyjZlR3w4oYtRsCfXoK3lWw=; b=xljZojAdnaiZBDfn8BtjShQhuS1OgefHH8DXhHtSlQC4cqsmrjZ1A5sa+kYphOGTtj olfi6BG+LTDoGejg1uNfJn2PiRxk5LlGEEgsXqz/R29rVPFnkf2ZGHF33HtSeOszm+aT zjb7HgUJRGklKAQDtlZMXLGo2ZnGSpuFmIZYeUL3ucc/0mGSuMQVDWJllj/8BSEaQKlg m/HWH1hHZnt2Rao6kl43jKsPYuAgBoYXNCw+pfBEZKmIf/ADy2U/9TxUMx9MZ7X/MmmS iSxjOs2M3ihdIscHoNByInDWE6+b6F8B3qZIAe+iRuv/3Vu/X0BLK8JlzAbWfOnULKNa ssXg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id g10-v6si3155393edf.328.2018.06.14.11.28.27; Thu, 14 Jun 2018 11:28:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id A834FC21DE8; Thu, 14 Jun 2018 18:24:40 +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=none 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 1C86EC21E34; Thu, 14 Jun 2018 18:22:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 27748C21C2C; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 71563C21C27 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D65F2AFBA; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:28 +0200 Message-Id: <20180614182232.78201-8-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 07/11] sandbox: Map host memory for efi_loader 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 efi_loader we do not control payload applications, so we can not teach them about the difference between virtual and physical addresses. Instead, let's just always map host virtual addresses in the efi memory map. That way we can be sure that all memory allocation functions always return consumable pointers. Signed-off-by: Alexander Graf --- v1 -> v2: - only compile efi_add_known_memory if efi_loader is enabled --- arch/sandbox/cpu/cpu.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index cde0b055a6..23d8b70648 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -5,6 +5,7 @@ #define DEBUG #include #include +#include #include #include #include @@ -177,3 +178,22 @@ void longjmp(jmp_buf jmp, int ret) while (1) ; } + +#ifdef CONFIG_EFI_LOADER + +/* + * In sandbox, we don't have a 1:1 map, so we need to expose + * process addresses instead of U-Boot addresses + */ +void efi_add_known_memory(void) +{ + u64 ram_start = (uintptr_t)map_sysmem(0, gd->ram_size); + u64 ram_size = gd->ram_size; + u64 start = (ram_start + EFI_PAGE_MASK) & ~EFI_PAGE_MASK; + u64 pages = (ram_size + EFI_PAGE_MASK) >> EFI_PAGE_SHIFT; + + efi_add_memory_map(start, pages, EFI_CONVENTIONAL_MEMORY, + false); +} + +#endif From patchwork Thu Jun 14 18:22:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138604 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2454383lji; Thu, 14 Jun 2018 11:26:31 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhgx+QkHfQQV+4aKgBBA6pKhXkIOYCmIIaIHijraPt+bSNr7032uvP+Q82YQ3vmDCFTwCp X-Received: by 2002:a50:bc16:: with SMTP id j22-v6mr3551520edh.240.1529000791348; Thu, 14 Jun 2018 11:26:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000791; cv=none; d=google.com; s=arc-20160816; b=TC0+P6mez6GneYVsMp4vySWuaRf9C/4GkfVWH0YXsBvotx79UfrG8epnTOxZoJhdRt X+q+DW6peSOeFegrsmfuRti9zNwFhXQnncrL/gI6PUlCEsk81+1F775GAbTmgnnhkSuI EaNYv3HF0GU5bK3iiaG2Jt5KYmGhpSh25T/3B+0MEM+LkxppRw23roz9lKRUAYNK3cCn Q/dcJo8wUE+9fPsqRbusEtBs89veURcxxBEvGPkzCZxLMpJbyBUi1KRE3D7KxQCCaDp6 N9ZxqcXfEUWTqTahK7lsXBnpL9Y9udvwGI2M5sXw8b1OwW+kcn15M8XFdzPdLBZTjWMN pSig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=lUY8nhYnWYnF4GKFYcy3Jz6Bm3iI6YSxpZIPv61qQtM=; b=fUDIEy8JkbCyKpVa28PNjU5Ejj2J+SRHTNmjSjWtFJHwGL7tKmZouHsZ2F12viFkpJ Hps2wJdKR3O0WaF6lg2kqIa3mFDhd5crr77ppHCHMN24BOCjXt6ZJCtV0JsaeDxRcuOq fIJY4I9b/vrMHO1NWT4dWwLaSgSD9DRb4OejKWMyAki5CtPqRN/DZrwe4V7QxXnF4ww6 V9KU3YF4pnHES151kg8lEvC1soKVh/UlB/Ud+sDa96niTCKajVqzMhirOYNxqTorStEg Alv1kHDgJuflog4ClD8470LQ2Y2ebIvObMK+j30Q+6aV/Q2QWJPuB+YLuHmQBNycjV6i Fd5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id o90-v6si1943376eda.373.2018.06.14.11.26.31; Thu, 14 Jun 2018 11:26:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id E5CD1C21DAF; Thu, 14 Jun 2018 18:24: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=none 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 230CDC21E36; Thu, 14 Jun 2018 18:22:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3C832C21C29; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 649A1C21DA6 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id AB44FAFB8; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:29 +0200 Message-Id: <20180614182232.78201-9-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 08/11] efi_loader: efi_allocate_pages is too restrictive 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" From: Heinrich Schuchardt When running on the sandbox the stack is not necessarily at a higher memory address than the highest free memory. There is no reason why the checking of the highest memory address should be more restrictive for EFI_ALLOCATE_ANY_PAGES than for EFI_ALLOCATE_MAX_ADDRESS. Signed-off-by: Heinrich Schuchardt [agraf: use -1ULL instead] Signed-off-by: Alexander Graf --- lib/efi_loader/efi_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index ec66af98ea..ce29bcc6a3 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -295,7 +295,7 @@ efi_status_t efi_allocate_pages(int type, int memory_type, switch (type) { case EFI_ALLOCATE_ANY_PAGES: /* Any page */ - addr = efi_find_free_memory(len, gd->start_addr_sp); + addr = efi_find_free_memory(len, -1ULL); if (!addr) { r = EFI_NOT_FOUND; break; From patchwork Thu Jun 14 18:22:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138608 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2455625lji; Thu, 14 Jun 2018 11:27:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbGA44sQilYPiLzfPvxMq6HCSf8qbF0KQ+bomI1apxXlctI+x+4pCjj7w1iZz92/ROtI2N X-Received: by 2002:a50:9a21:: with SMTP id o30-v6mr3540734edb.236.1529000871636; Thu, 14 Jun 2018 11:27:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000871; cv=none; d=google.com; s=arc-20160816; b=unycNhgE4gW9PnHuRx7hwtU6OJj1lssPJkne1vBvX5Zz1N0GEeIbINM4FT86mvww4i eWW0Mtz4utmVVjFXVk8Y/hZxrKw1qRG881EoipaksME103mJmYSWja5ih4ouFql5W1D/ fm/lJgeR/dYoaJoqG6v/Uxgie9GwY+EbtTJXSLvPrxM5iT8dr/p9bvtXqRgHZSfAIR8z 8uy6uH3zu44iHKXy0MmR1CWkDqXQXz9WDJ7uK9TrBMBKCklsL9FgGsOHb+5EByXGZeX9 HbG1u4BjWBBQ+H4TalXrFuKmeJKBEuySj4fi1hj1H4ZQo2WjVJdzEA5/Kh4woaP9G8hr 12Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=eeSrLwpw4uMA42nSFehq+HVZdRgGGASbpnV1TDpLDuU=; b=sBDnXzQsh9XpZWESuAes2qsEO5pSpTv8x4WeWsq1zezaoyjtDCkgranPAhovzAr9r2 lHcpzvxec/HRY3UMKUpvXltGbp7y/8dWXRys85qy9ZeAqTQKHPta+n0//Lg4S0dDejs5 W0eJgW7CHhnM0iWwxnAuAfG3lEeQiX9JmbHIENXkbc6Qs2lxcwTZ9xadFcBK0Al9GFtN NUA7DSZu1GuwLJe8sjjKWQCB6hfrXId4+zZ71q2tOCQDOw682Qmyd5eYGmCNR6jB6Nad 3JdT9aeqeb3pIwDAu0qfUpjaYyfeMvVyTNZMY1Pze6DXF/3KNYBOM4QArlLgLle242R0 sokQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id c6-v6si2101393edr.105.2018.06.14.11.27.51; Thu, 14 Jun 2018 11:27:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 46CB0C21DFD; Thu, 14 Jun 2018 18:24: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=none 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 06E9BC21E15; Thu, 14 Jun 2018 18:22:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 007F5C21C29; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 5D348C21D74 for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A8EC3AFB7; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:30 +0200 Message-Id: <20180614182232.78201-10-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 09/11] efi_loader: Disable miniapps 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" In the sandbox environment we can not easily build efi stub binaries right now, so let's disable the respective test cases for the efi selftest suite. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- lib/efi_selftest/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/efi_selftest/Makefile b/lib/efi_selftest/Makefile index 4fe404d88d..bf5c8199cb 100644 --- a/lib/efi_selftest/Makefile +++ b/lib/efi_selftest/Makefile @@ -41,7 +41,7 @@ endif # TODO: As of v2018.01 the relocation code for the EFI application cannot # be built on x86_64. -ifeq ($(CONFIG_X86_64),) +ifeq ($(CONFIG_X86_64)$(CONFIG_SANDBOX),) ifneq ($(CONFIG_CMD_BOOTEFI_SELFTEST),) From patchwork Thu Jun 14 18:22:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138605 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2454409lji; Thu, 14 Jun 2018 11:26:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIEkZ8QhtloFLNYIrBwN4QQsQqV3+ay2lLs4l6lx1Fn9ccKn267oIC1EgRxQw3C63yFKlb+ X-Received: by 2002:a50:bc16:: with SMTP id j22-v6mr3551568edh.240.1529000792597; Thu, 14 Jun 2018 11:26:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000792; cv=none; d=google.com; s=arc-20160816; b=JTYcXZY0Ofhp6iLClka2/+Y/qfwet+4p03vlHnau1uMhb6vizxb5QGqENjNEuOlboD b8t8PfIaUYVFwN+7cqfaj8Sew/xsBKEF2k/bSjTZYh9eLK2EzG9BbVuIEMvBJwn8pSqe NvIlxULu7vrqkrALRq61G0gu19/phTY4m3R1f1QJ9rFrhzX8fBHQycHDM/gv9xS4DEhk Hz9yBXHQXBgQjczApsVy6ItUom3WFz6NI9deT2aoZrZUj6RfHHrJc1D4GAGtyQKvxuCC Rs3XMzGGqYdhFhxuVOqXFGVpG+83r4zEuHSgrbDniVOE3juTKlZ0a6r330gtKiBKGnSN 16FA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=wfyu6bLfYDi7GyIsoVa2Co+230ZovcaJgMEgSgwQ7Q8=; b=EOfqiauexi9EKcQNsq7cQmcLCd09QPZ+HARPb5vR3m+algCO6JVd4IvcDhLDbcQ0D7 87t05BgwU2xN9xq5/g8BAPS2ohZrLLfRJ5mu/cbB2mfP+PXLIed1VFmbUz1I0QLg/sEF XRl22vTrU0KuPLlUCMTqTWIs0zeoiKo5Okd9GTIo7tyobkKRTGi7wAbDMSebsCuady5E Gix+ffowsUVnjx8aIsbs7O61Hy5BhGMYGKOgAvgmZ48KXVvddjXop1lYukakxyBi9qSe KNWob70RGtm0EidOpSQndBr8m3qHz3kmRUcm8GFAalJ+mDFBoORdzJs5Y8p84UdZEPV4 4wAA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id s48-v6si2115925edm.333.2018.06.14.11.26.32; Thu, 14 Jun 2018 11:26:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 37792C21DAF; Thu, 14 Jun 2018 18:23: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=none 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 5AA78C21DB5; Thu, 14 Jun 2018 18:22:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C40FCC21C2C; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 5F711C21D8E for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A4365AFB3; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:31 +0200 Message-Id: <20180614182232.78201-11-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 10/11] efi_loader: Pass address to fs_read() 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 fs_read() function wants to get an address rather than the pointer to a buffer. So let's convert the passed buffer from pointer back a the address to make efi_loader on sandbox happier. Signed-off-by: Alexander Graf Reviewed-by: Simon Glass --- v1 -> v2: - Clarify address vs pointer - include mapmem.h --- lib/efi_loader/efi_file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c index e6a15bcb52..2107730ba5 100644 --- a/lib/efi_loader/efi_file.c +++ b/lib/efi_loader/efi_file.c @@ -9,6 +9,7 @@ #include #include #include +#include #include /* GUID for file system information */ @@ -232,8 +233,10 @@ static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size, void *buffer) { loff_t actread; + /* fs_read expects buffer address, not pointer */ + uintptr_t buffer_addr = (uintptr_t)map_to_sysmem(buffer); - if (fs_read(fh->path, (ulong)buffer, fh->offset, + if (fs_read(fh->path, buffer_addr, fh->offset, *buffer_size, &actread)) return EFI_DEVICE_ERROR; From patchwork Thu Jun 14 18:22:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138607 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2455201lji; Thu, 14 Jun 2018 11:27:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKnetiRFhD05kjlCCnyfhnpMaYo4a52OdazpEZ8S3rAkaodYF9Wb7sw/TA2s3tVxPT+cYtf X-Received: by 2002:a50:9e01:: with SMTP id z1-v6mr3563956ede.246.1529000842565; Thu, 14 Jun 2018 11:27:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529000842; cv=none; d=google.com; s=arc-20160816; b=N9aKhhcDvtR7pJyTsaBEp05SV3u09bVTBNVyNKQCTQVGJgYgWmWGC+Y3jWXt3JTU6r yPEm5Magc0lti73O7U8OPRkYy2GVw8zw+vxdfjdhcsEBg0MMvyt41IGW14zac2PMb7aQ SP54oEiomuTxy/6arRwLwlOYD8mWeUcy9sOsFBCJpknhvwuJqMORZakAHbzqF6JhsCML 5btpZBYfVW3pI2noDR/eqBvEV0DiGtGOjzWKr/zFWVATu+yoNostPcPXSQn5+Hf6L4AV NpF88QVHuUej9wNUF0cihWPrtW31apUdyAoVEHLHpGJShbVjNM0ORPx6kpqIWbjQH9ix Sk+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:references:in-reply-to:message-id :date:to:from:arc-authentication-results; bh=irZnT1nzMA/NDgFCc8DHOr3IeSnoIbqTeA61sLv2B+Q=; b=1FDv/TdBcLtOKdXsI91+z3boL0whZjTk8BU9EyPtAlIwUouUPZdBUcL8W3/y095bpo Wa22xUlLHmUNz8V0Kr/ZVdASFnfb3pd1cxVnHnk/OtVMwi4FS3pd//IRWXadJ1pOxzo/ /OiPnpA1Z/8nSSceNZzSHhuQLJ7D2UUW1flcDY/mUtnxmi24usMoM/JBcBrnK8yT+4B+ 64gsfBcPVblIWfT5yL0mcS+GxpE4RAItrPq4twXJcFAkEDDQj/Tjo4LnNyrpMIAtiUrW tFI4hPiugOaH5+7QtaCm1meK1N2HZdjl3UQ86p6p0VXx3LE221LmyA+P6jGuB76wE32J n5Yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Return-Path: Received: from lists.denx.de (dione.denx.de. [81.169.180.215]) by mx.google.com with ESMTP id b34-v6si913028edf.218.2018.06.14.11.27.22; Thu, 14 Jun 2018 11:27:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) client-ip=81.169.180.215; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of u-boot-bounces@lists.denx.de designates 81.169.180.215 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by lists.denx.de (Postfix, from userid 105) id 34A1BC21E15; Thu, 14 Jun 2018 18:23: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=none 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 F1597C21D74; Thu, 14 Jun 2018 18:22:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id DA6D2C21CB6; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 67204C21DAF for ; Thu, 14 Jun 2018 18:22:35 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D47A1AFB9; Thu, 14 Jun 2018 18:22:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 20:22:32 +0200 Message-Id: <20180614182232.78201-12-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614182232.78201-1-agraf@suse.de> References: <20180614182232.78201-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v2 11/11] efi: sandbox: Enable EFI loader 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" From: Simon Glass 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 Signed-off-by: Alexander Graf --- 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