From patchwork Thu Jun 14 16:33: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: 138587 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2340699lji; Thu, 14 Jun 2018 09:39:05 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIqMqwoq2qeYJzDNqgG19X0Zd8o93Fgz+rjiccfRWgGcPIPESHTt/rRI5MxPvOrrGkGJij3 X-Received: by 2002:a50:fc88:: with SMTP id f8-v6mr3291750edq.166.1528994345488; Thu, 14 Jun 2018 09:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994345; cv=none; d=google.com; s=arc-20160816; b=fRjr/+KDKMcOKYpnnold5TAop+hFCY3f26FmCStZcxn52IiMr5XbVcpxttbJ4H52AA EJ2bJBm0MyA957owjMQeAQlOsEat2JDSbZANBF6VzkH2L+ukg8Nb5rbPBCm6NdXVWNmg zIA5GkiKOzc/+1D/UHeQqpqOtyP8sqot5/FPMafTsAmpXtFv4wW5fQlz/47/UTy8TuFa 5jQgfr8CsAkPtTQVPAHwn2nOVSImyz09r6VRWLVS3yCYBf0INCaEX+V/enSQWnmJfPdN v6lz/uxKCEh29OcZwkU86FHMPfGMTnwE1BzhetUtodbkutg639jPMDYTJNyrQOI3SFrw UnvA== 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=CP8XB6GEynPOkrKyA7tCKByi7ykrv21VhnsTZXZjXVB0I1usf2ZmanmzGog2clDYAs 0ktiOslgeFe8AGLdN7wU3AN29LB8fwCS1MG+WrpzF0jjTi55qcIo/uK3t/aCx8KCThBG nKztnoWpab8OJXYxh/ReWpAY/shwYrMrWquJfIFR4EOCdnX6Go1v83X2b8z7FGecMpye 7QMdIyCFFCT4uwPysMFpG5FZM6th29fp0RcSPA912DqERxKueAE+7alKf5+7r9PxCRB3 LnBhqKP8QBUGe7TqTxDQqgKm6sHxLcgSa8kyZ6pSjZQCELMUWjTGFi3snOa/X2S2Stgz P8jQ== 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 c11-v6si1662816edj.417.2018.06.14.09.39.05; Thu, 14 Jun 2018 09:39:05 -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 09A2EC21E47; Thu, 14 Jun 2018 16:34:31 +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 2A732C21E31; Thu, 14 Jun 2018 16:33:39 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id E8F41C21D83; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 48E38C21C2C for ; Thu, 14 Jun 2018 16:33: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 AC1D6AE86; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:24 +0200 Message-Id: <20180614163334.46827-2-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138584 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2339447lji; Thu, 14 Jun 2018 09:37:52 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIlWB4DGOlyFB0/A8lrybzDCAILDL2WZ8zCtkZ6vuPvL9Qzb4TWj8iIh5ZK93DyQX3VlUF1 X-Received: by 2002:aa7:c1c5:: with SMTP id d5-v6mr3292661edp.148.1528994272863; Thu, 14 Jun 2018 09:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994272; cv=none; d=google.com; s=arc-20160816; b=kH4z0cf7dmiIKROM/HuD47mWMJDnoMY6hJ4VkMeiQBscsn25aSFqXl41ropXKOewgc 6Qwg8tfWhrxPVfranzkmNIwd4Ez9VKIhQWcYeQ6H8KPBKm0UWoj5K9ThwehOS/JAiZ48 /+Gq5nqMQaZd0RTIFTxO7mVukVtNlSLxeOaEoiZx53cts/vlaq3lrgWwX7uYYp2IZEO6 wxSD2lUQu1xiC85Ba6Oq7iokpSr22WyfetSQyN5S0drM0qEUnWQTdY/gU+reeQANIrDa S/3goG/NrdEzwbJbZtyGSL0+tpZW/FeYaDGwDmZHquRt1VmlJmnVDAWPtPNonHEAwRaC HnJg== 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=NhDqBrpCkyGxZH98npKGtllQmooAZnlVyjYA0QBitaZl9PZcPzHl3sg6sDl2SQIyXQ kJvUO9V27kucwZhpawRTJZliPBn6cvrcBJG+R2nMm9kkk8WRcSRHYXqFTC55JKc+OTBR fQd0Ku9ujPLe+zdGuaES9QhzyqqLAiDfDpUbBFY7oD77qvoQaMmO7ePbB90U1rkWgkOH fbKVCA4vNKNhaGeL9C/JkSYtp+awnJUqwI29dypiDdKv24pLCVjcSi3iE+5rRUV4r7l/ xAGq4KcX1zHSUGY0F9gUA0I8ucYjuhLuEJuyzQdQfk0IBs4trjNSO5FD6GOV0bCkry7r wnCA== 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 f24-v6si2604692edj.330.2018.06.14.09.37.52; Thu, 14 Jun 2018 09:37:52 -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 65973C21E1A; Thu, 14 Jun 2018 16:34:49 +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 14180C21D83; Thu, 14 Jun 2018 16:33:40 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 15F8DC21D8A; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 4F9ABC21D83 for ; Thu, 14 Jun 2018 16:33: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 ACE87AF05; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:25 +0200 Message-Id: <20180614163334.46827-3-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138580 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2336162lji; Thu, 14 Jun 2018 09:34:47 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIavYVSrdl6aQxr9dIpfTXEWczqzSi9gBrcAK567AzOXultivrO7Lv7jVmusp038p765Sw2 X-Received: by 2002:a50:b223:: with SMTP id o32-v6mr3220502edd.184.1528994087252; Thu, 14 Jun 2018 09:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994087; cv=none; d=google.com; s=arc-20160816; b=xHUkKY2HWPeEbo9d+cuzahVhyg3tBpZpxP77ess6146cFT9jmC8xhx2jYEI+0NIxtZ df80HDpIDYSm+SvGwBW6Gvj4AeYmVY5nvs45g8rulb0O/FjErTI3vMZYFTu2XLCAyXew uaSO6JHOu/hK2Rv4wtrZxnU1be1qVOAm61vMgM2qVQ/dMcotEqOGKAdSgWlujCJ5WQgH k33feaiIx1WchVq8VQ/WEFyS4BB0FVBw8Se68BB+ds02R6rYrFBC/V1dY3RK3fUqdGoH eB8bYKUVyq1rxOBRa7FSvo9KKt1H34tKeSjOkIv9mBhllXDD826i8vRkXqQazoruRUvz MXbA== 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=TVERNtynAa9uFd9eGfXEhGUqUbHIUWCY8JhfYhRjpCdGLaUpyWWIkBUtwYZjW7trnI C+wuZ1UeL127xhN0tY4FXD9J1+C2ctrABhvPrdmRrBTC3vPUPz7bMERni98+5ng4ZzrN 3mn5QzHq6sjAf4v96blU59YXSJczI9NE+F9zPPH/oOOAWeZ/t4vaBmCnGA9cjV/0AGeE YZQGDkFt7nWGC9nqxAdhVbgwtGFJmfQxijumdTnZ7buBPPVhTdEsvO4DA6gBM37YUDiP KuuU7lneiNMsZF51iPw2hsWW0zh2nBAi3GZ/zJc1nW1wsY1OInT9qVpveBVzeCpO7BPQ LobQ== 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 x21-v6si4770164edx.74.2018.06.14.09.34.35; Thu, 14 Jun 2018 09:34:47 -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 AD619C21D8A; Thu, 14 Jun 2018 16:33: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=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 83641C21DED; Thu, 14 Jun 2018 16:33:37 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id BCF1FC21D74; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 4F9D1C21D8A for ; Thu, 14 Jun 2018 16:33: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 ACB51AED0; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:26 +0200 Message-Id: <20180614163334.46827-4-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138578 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2335183lji; Thu, 14 Jun 2018 09:33:54 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKPdALRFVpiQoRPV6eRP1U4k+u7DQcRZAILsQ3GxL0KVGvTW8iIbdhW0kkddwmAIOgrLWk9 X-Received: by 2002:a50:bdc7:: with SMTP id z7-v6mr3212546edh.84.1528994034586; Thu, 14 Jun 2018 09:33:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994034; cv=none; d=google.com; s=arc-20160816; b=AdG3dqs1M8Wdk9lQu9yvDWs7nkg3e50RXlrY/Vn09UcUtZEHS5BFRv+8iXDFPa1cx0 V2ojEtK7AosZzJx0lokSeLCBhFbzYx5zmi2J6T783eUY0N96yGXkAev9iY6FdEtP+XVg nSLsnZ6mNro6Ipje6vWKKjt5q4Xuu4RF+TS9YR9pUA2qAN2s4Gocg+l6SAbVMeSMoFgs qX8R8juG89ae3j9hHMZ8hzhz8E0TfLRyfIWn9Svt25EFr+Dn8xBg3kHYOMhS0Xs4npd2 ehOo/sfV7PmDYfxpoReTMTdfwh7yTR/htKpErQcNCwC/emPXDYxMq96Aj7sP8zgripaK fTDA== 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=W3purPwaQM4Ec88cXoZQrQPGkUJDCHxx2znlzoAwe8CmBmMuf2MmanSadKllFDiPpE TWewCGJXcYtRzlix4MBLrhKepSOh2qypD+L399L82zk1FeVRuK0G5lfVGE4+IkpabUe5 JVQL4cywwmE6ZfdY9FF+OOKVROYa4dqCEOTN6N76cQmjwvENhtRhimDUvzmmr3yleDJG 6r2Ym1D+0V/z6mCYbbittsnlaxi3vElbYEx7ZST2edPKDC4do3FqVnRvA6skVUkid5+v iBR+wifVoF04RtwPheEZl7g2WLFHf310YwkuDjxM0QKIiPBs/Gc225XuiUcjU7UslV8v F6zg== 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 e11-v6si3677826edr.447.2018.06.14.09.33.42; Thu, 14 Jun 2018 09:33:54 -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 A3D0CC21E30; Thu, 14 Jun 2018 16:33:38 +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 B1CE3C21D8A; Thu, 14 Jun 2018 16:33:36 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id A7508C21DF3; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 4F996C21D74 for ; Thu, 14 Jun 2018 16:33: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 AF0D7AF7A; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:27 +0200 Message-Id: <20180614163334.46827-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 --- 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 16:33: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: 138585 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2340241lji; Thu, 14 Jun 2018 09:38:39 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIbqTJYXCXALRXMgquA08iNcQzXMimCNmvXb/ZJDedt5SQ4dee/SjrMv9CRA5z+iPkO4G6v X-Received: by 2002:a50:b84e:: with SMTP id k14-v6mr3236621ede.307.1528994319614; Thu, 14 Jun 2018 09:38:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994319; cv=none; d=google.com; s=arc-20160816; b=x4XR/xDkWdTT7uTtvrv82c0xlXLjol+Mvh0nv4g4YRsZIQvBQYiLlE6fdQoajFkBay YFFU/sXS3PYfR06vClB5+UfK1ryzGCzonWSvJ0OFsZwbo72xKhc16V3ivwvJToH875oA Harex6kTUSewindkD30xEBlpqdRAVzxh3fzKo7j/+TCYWDR79JuNNknRTMq2IbqcwA9I rLWtm1PS9pJdVIOMJ0Wc4NcfsAPM0yjCX38WxmxA8mW7NTb1r1MNFecbKfAnr9z8uMTC b0dG+W1W4KDvRZAVgz2C+FZj7mKU5gI7ZL7amKar81TR73NN1hx+/j7nbqxfNDU20e1k SXvg== 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=OqRDpuJhN1HJ0WO2+m94zugbDPtVk1jToNhpEi5DDLb+sLfZMhMHYqYGvEdIe30HhB DkhA/1jfhZjDtx/waoMfNJ7oE2OUesahe0dN7gpTpErJe258hNQK3BLJC3+wzf5cW4TZ XEwlz3st2ocy0Zthnov0Vs+0WgsmRKaK6hgfz8768j483pDhIRQ7A6TgtNc2TKCYXc4d pJc75Y2O9jGwGZ9g+/fnyt8S9d4gg7T5AQwenqmFGjsWm5LlGACcw1T/JkWeV3k0SSvG Ar/5Gpa6Kxd8q6MGehIB24atmYDw5vuAtsDwefhcD06fRu9b18x0DtyrZMnq6Mgle5Nn qHcw== 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-v6si4440173edp.378.2018.06.14.09.38.39; Thu, 14 Jun 2018 09:38:39 -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 1F5A5C21DA2; Thu, 14 Jun 2018 16:36: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 CF76CC21EDC; Thu, 14 Jun 2018 16:33:45 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 96DFEC21D74; Thu, 14 Jun 2018 16:33:36 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 86C62C21D9A for ; Thu, 14 Jun 2018 16:33: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 BB11FAF7C; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:28 +0200 Message-Id: <20180614163334.46827-6-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138581 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2338010lji; Thu, 14 Jun 2018 09:36:30 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIJ1+TXPyiACberxKtyS6rXca8yWo9dYsPclfI6NFAsLcnITl22IwyLJOAldnra1rA4BWwg X-Received: by 2002:aa7:d60f:: with SMTP id c15-v6mr3251745edr.301.1528994190755; Thu, 14 Jun 2018 09:36:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994190; cv=none; d=google.com; s=arc-20160816; b=X5FtqZs3Kh1NlbYbe7jVIWISPV8fu3U7b8s0SLZ2+kXRCvVHPtTuFr9k34h3s3dMMF nTHwFj9vb0JBsMpBDSJmmzKvso31CTQzUIVcZKd4Frv+oS/bSkSR80Oq4iHjuyHPT0t1 faWE35aa4bR7ibAwAJuD946vX29A00No4TzQ0W/5FGosXBCs8rzdRY2MxA+5gQEJjaxO 4rHUhcVUIYIolfMhNNfCJJtPcIL28GJWsJl5MltXQpmW6iXbJ57vRmztbtOD6rmywUNJ XpnpoYtW0N8jQEVFuSQj8HZ4rV8y2LVFY35p4BVDgL2tc28u+nxDZk0dxIpRNxBPbBD7 TSUQ== 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=M6c6lsw2JYbaUiocPaG+Yd+8GX9o14wZjRgPlbBSM3PFkBCKUNRL5quTYIPjFkg0B+ t08SAzq5t/uSmIKZ2LQo2cFRrwXPlql+AKmoBDDBUzBb6xw7YIct7XkEkmXiIAE/IlHk NfIOCXLr7XdLWDcm5Wjl5tHH0jUdOCODExqRh/qmptwkUNCyXsnyUYdDCIyhO5ASJ8Aa 6hb33ZXFXwT+CnZPB9MZwwk8gsBtjxWT0yYFz89k75yCHuFdfj9uwoBleBD9OT2ET3qV veSeQzVBlE7VBQ8nxBZyu6XvHMaKFpOW37u2DjZpA8oiy9JjWbqGnSwrc3Brp+mMafnU uyrQ== 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 x58-v6si1103357edx.441.2018.06.14.09.36.30; Thu, 14 Jun 2018 09:36: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 D175BC21C2C; Thu, 14 Jun 2018 16:35:21 +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 0B2D1C21E39; Thu, 14 Jun 2018 16:33:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 3D65FC21CB6; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 8B27AC21DD3 for ; Thu, 14 Jun 2018 16:33: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 C6152AF7F; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:29 +0200 Message-Id: <20180614163334.46827-7-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138579 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2336066lji; Thu, 14 Jun 2018 09:34:41 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMymvjQJtKE92yregtnrLsJ25B5GHupATsyjyM0j8EXf4OuGO7VHUa3Aff7fKZbfyj8WgG X-Received: by 2002:a50:ccc8:: with SMTP id b8-v6mr3250693edj.98.1528994081488; Thu, 14 Jun 2018 09:34:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994081; cv=none; d=google.com; s=arc-20160816; b=PDR/PQpAMlB/1laKBfTnSYZyDeRKMOIoLZp8LuWy3T0pKHATYxbV9mPsIdUbvg5ze9 wcEZotpn7MaM0SrIqKxkhBw/212B75WHoGeFAgPUCaRzNON/t9WrDivx8E7nYWWSPFGC ZJd3DnWEP0D/62AKShkw3R4YueH2Cw8uEXtEcu+6Txg2BDdZ6mo6MRubhID2YLv6GAGf 2Wb+ao3xHzNPsLnNfi+8ba8UFWyUZuztHUnbzij5ab/lTCkEEAt6rTkDzN70hbZj2pLv eqQ5N9X8lkkSPgsC61ZouZxdXsd2OLhVvbih5qGSSQQCS2tDqzfDSDEPPjt/cJtFrOOo nXkA== 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=uGAk8kFg6LURcHy3QGbkFwr9HqH/h2jfCcBBvU4IIM8=; b=g9Tg9QwkrGFDN6fvtMmwe4tFWn5WLm6u8/NjSF7XSoIjH0rnqQm58Boi2CeqYAmKaT PKIN33m5k/v0bLr0nRvAleGpXGOwdXw8BiSQBpIgp8aVzvFrsGnPEdyrq26mzflD+WcR 7AWGJrEULY7CNNCFjJCHYWpJ0/gMtTo00WYpv8M3m16PwpSmJ2Mt8BFeT/eyu6zZvhcF zwqG/STi59HL8XuJXPcH0RTW6uAiBINuQ5Y9tOncJ86DNrwbB2n7ktE/J8a0qjYn7cds K7cEDZp+oF5R6KZDWR5K2TZK07u+zD1dpqH2GaVhs5qeNSVHLZdeBL+kT1Z21dJgTnN8 oT/Q== 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 e36-v6si4372859eda.181.2018.06.14.09.34.32; Thu, 14 Jun 2018 09:34: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 C2E52C21DF3; Thu, 14 Jun 2018 16:34: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=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 40013C21E1A; Thu, 14 Jun 2018 16:33:38 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D8B54C21C2C; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 874FEC21DA2 for ; Thu, 14 Jun 2018 16:33: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 BF45FAF7E; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:30 +0200 Message-Id: <20180614163334.46827-8-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 --- arch/sandbox/cpu/cpu.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index cde0b055a6..b4f1e22cb2 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,18 @@ void longjmp(jmp_buf jmp, int ret) while (1) ; } + +/* + * 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); +} From patchwork Thu Jun 14 16:33: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: 138583 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2339420lji; Thu, 14 Jun 2018 09:37:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIwF26Dbei85+Yjudzw0SaGztBfNb1f1CrjgHJEOGSt19887fPRFYJb/1Z8HK7n3EcGWHdz X-Received: by 2002:a50:9793:: with SMTP id e19-v6mr3223751edb.58.1528994271891; Thu, 14 Jun 2018 09:37:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994271; cv=none; d=google.com; s=arc-20160816; b=xKuM1vyx9B+mt9wNycunw9tA4YQ9SVxd5h38KuSxLnlJuJDgPWwXhoWsb8uOi/NHSv BuuUo6S05vAr4YaPgbRvpUgoceSbbYF04i68GDgLjMabjdCIuKq5h03bzn51r8to+rYg fzuWyf4w27rTqE9Wa/pXPEze5TQiCSCtCM/OjPOYLIUPsmyb2w+7sI4poDBgCxfSBZf3 mnfNY61y4QPUb02kAZoaj+GGQwJKnjVMH3CeGrBckLrNVfyq3uHPGTkpbV9AX4vm52N0 XagpRkuFem2HwzitwrNumi218Ref2Uyy+j5fY+jzhg5S3fgznPpiy42Bllh4uyzo4WiZ O79w== 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=i53Hy0Iw+MJYUBCDSAaWIV2UjqrLpH1wNbmtbadPbI6ucE4OIiRitoxtZmm4y4GR2E OG1lSgKOxdlnsTZ0C5wtjy8iXNm50neYTMgdAC/v9C2OSUJS+MMHhnRC14kbr9F3WClP E4G05QHbQPGtGL9fw8EqPqqnWveMBJmJxRZFKwXLmksF6YLiNLvBQMOIlZuaIsYIPs9X hzRGNCdefh4zFySk6gD6j1RKXjzGEoOuc8Kb8gM6//+V7N2wIxea2yXlGSaHL1Do1ak/ FIlv9wLOXvVwE7baHpkZ5KibgFiQ3rG3GoYAgAQffxcv8iMBTWgkP2H5s2v5q3tMKu++ Pivw== 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-v6si526874edd.246.2018.06.14.09.37.51; Thu, 14 Jun 2018 09:37: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 7E25EC21CB6; Thu, 14 Jun 2018 16:35:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=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 EEBECC21EBB; Thu, 14 Jun 2018 16:33:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 5282CC21D74; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 8805EC21DCA for ; Thu, 14 Jun 2018 16:33: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 BD037AF7D; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:31 +0200 Message-Id: <20180614163334.46827-9-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 16:33: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: 138586 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2340308lji; Thu, 14 Jun 2018 09:38:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLdKzWjGfLMcs+w27Owk1lIAdKSgU8OenafbtN1wlVC9blKAw9yUNRRgcKdUKTzKQVirJRe X-Received: by 2002:a50:cd96:: with SMTP id p22-v6mr3177601edi.159.1528994323009; Thu, 14 Jun 2018 09:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994323; cv=none; d=google.com; s=arc-20160816; b=X8fWGmNOEHazwV5hDTw1UURbER74Fw6Zlx4RMao3Xi+ImnK1Wp19Tg00S83Kb6H6Q1 cVKg8Id8L8SchxFzRmRkhefeEHb77yYJAy5rI6ZJri9CYZzCihPKfKoT//j4ymae/1+6 ggyiqVGBUb2LvFqc+DfZev7EJEQZrFv02QQKbgjw0HJnTvMYcacBaY7xoAxM+261iCYy eJzpVWcy9pU1yvYBF2nZzgLpeWe9CpMUeEL33kYW2uzO8NZF0P1Nsw1vKroMcYAliJ+c uxqnMF8zgL5RgfJz/dkQtyeSrHvc2sBb1TFXJk/hlwMTIFwdglECO1M/9TFyOHZHx1jy V86Q== 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=MOPnO96YzsETKd1m5CSYiXb7+1fCOemPigyXyYXmx+tHC8MLgzaFjuvXzWWBF2hM2v onsxDa8VXoS4JdSclUYHcB/ByGX2u21lj0jF5DdkXEwzzrrub8QzqWwmxC7tsJQt9wOO 5inaaSoi1++0dR9nYbKhNPpljtYDuQ2tdx605tuv/SAsbgnjVlAkmRzRC+Ct/hOnYs4e w0zMgvCAQmdDi/1TBXyT8aV7BRBcGu7N/6tDpyYuQjgJJeq15uovvgd5LOIFiYE69PGn VvHmHzh9ymPpuH+QyuOFzDPlxF1iIDwKpLHWFjoF7rl0PE0VM7MTjme0LRe296xqjhWi qsCQ== 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 c3-v6si2923407edm.25.2018.06.14.09.38.42; Thu, 14 Jun 2018 09:38:42 -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 A7B3FC21DA2; Thu, 14 Jun 2018 16:35:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=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 2779FC21E47; Thu, 14 Jun 2018 16:33:41 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 2488AC21C2C; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 87E28C21DC1 for ; Thu, 14 Jun 2018 16:33: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 D10AFAF80; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:32 +0200 Message-Id: <20180614163334.46827-10-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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 --- 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 16:33:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138582 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2339110lji; Thu, 14 Jun 2018 09:37:34 -0700 (PDT) X-Google-Smtp-Source: ADUXVKL+ghkqQRRUclSyzd+kjeClLAhVRUwn4A5rDrStTl3qVw3ZCb6JwSxQb9llJdMjXzsN3CgB X-Received: by 2002:a50:8edb:: with SMTP id x27-v6mr3226460edx.128.1528994254585; Thu, 14 Jun 2018 09:37:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994254; cv=none; d=google.com; s=arc-20160816; b=VNSPikbtQau2XJbrH3M2P0GshyHo3vG644x+D1s9kTdT5PXGPBvF7i+or0ITy0QO0G MrymnSPX/VEYtN0sW80dnS59ulT+ImZNRBPwi3XSVqmQKgWauXijbyNE//GJdkT39795 lcDbCM1wz/zP1WXrAKQklQ6EFXUkSE6OorFuz560wDm36c0g4URkNfqz5C0D9R8cKike KWZki9VmkJdIrg+OaEdH3rRMeMyzlWfbEe7YUPN5n25sZay/7dEoXM2cPkxmo82eP+Fv P85p7e9j2gb971LmgQaEJeVZpqTipxAamQQEcWG6xwTdxVdvUkKWHRc/YOvwqIP0ILNz k9Ww== 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=tutR6kKRF032iMwhmxuv45N+m504KJHhEdnoarn9Rh8=; b=YaLDhYWQQdib5j/zu7zaTzZtqqaIehvehhAFxch6em1xGH6+17BLscVANvEYwfcah4 2gbutAIk/xRKlp/iJryTiRHufQBkpSlv67euHLw4Cm1FoaLhFcpW9xDxiK56vfbtopuW DPSwlbTdKMlQBqiAFlhSqnDem+CtU1ojpBZkVRzSROBNFTpcJl1hQhRWTdnF6iDFjlqn xNrq0xBqhCAacVf/mXCbJP9VselgcKnQTFhPQsMoJRtF9m9X62YNq8Nfj6owFN83qziA b/Ri2xAPPCug/SsN3pGmY6oDFy/BXQrHcAIwvscxYmEqlDocqFbPUbRdBoqX8pWMJmDP CCjw== 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 t26-v6si3317656edc.28.2018.06.14.09.37.33; Thu, 14 Jun 2018 09:37:34 -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 C4BFDC21E15; Thu, 14 Jun 2018 16:36: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=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 E80CAC21EF2; Thu, 14 Jun 2018 16:33:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B184DC21C2C; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 8750AC21DAF for ; Thu, 14 Jun 2018 16:33: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 DF06AAF81; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:33 +0200 Message-Id: <20180614163334.46827-11-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 10/11] efi_loader: Pass virtual 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 a virtual (u-boot address space in sandbox) address rather than a physical (host address space in sandbox) one. So let's convert from the real pointer back a the physical address to make efi_loader on sandbox happier. Signed-off-by: Alexander Graf --- lib/efi_loader/efi_file.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c index e6a15bcb52..ecf174a3dd 100644 --- a/lib/efi_loader/efi_file.c +++ b/lib/efi_loader/efi_file.c @@ -232,8 +232,10 @@ static efi_status_t file_read(struct file_handle *fh, u64 *buffer_size, void *buffer) { loff_t actread; + /* fs_read expects buffer as virtual address */ + uintptr_t buffer_addr = (uintptr_t)map_to_sysmem((uintptr_t)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 16:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138589 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp2341934lji; Thu, 14 Jun 2018 09:40:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJhGxfleIzrd5erHIBYugqzV0tDUfj99ubW4XaGu2Fmrceormw98Tg2tzXVp/Gqm8g/ExeK X-Received: by 2002:a50:f552:: with SMTP id w18-v6mr3281801edm.230.1528994422412; Thu, 14 Jun 2018 09:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528994422; cv=none; d=google.com; s=arc-20160816; b=PExag6fvo2jkUqeBReMCol+Cx1EnsaJEqq3183UEiHwkibr8cuY7G2vTiqC1ggLua1 uS/gkjPWbJTBm2xObuKctPswjIHkOTAx57rYT4BmlY/dBPF+6OROLW1QkHBqQMY80n90 Ou9yd6zOKRpIWIZL8nmovR/I3o17Taf+aI+DC9ZBxMOYB5qeLgZcy3b6IQXk/f9qewKa FJOSbBnW+dGNxL0SNl1AkZ9h/rTsNZ6txEzu0g8cIdqT0rK3lAOI6HG/0znOWqwawq94 rwFVnsHh+SWZS9SqNzXgiiRsNIujWB7In8rG0fTktAxcA7nFN3SFQx8jSl6LFbZmh01C y2qw== 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=h77JEONMAJIPV5z9OciuZwSVmxZr+Ce3eC55VrqpgaaZEOQ54Gpba9UqI1sLNu/nEJ rlIB7T0IjeVc6szT9U2M4Hex3D89LBXPTxYTXIvLOJqtDYq8QufWMRRBAZTJMddEt9Sl 7E54qHLjp4eqrFG1Jwlk6m2Eo89tRFj72jFIm1Hvetb997ZEYo6yEAeOL3vayc+lyldq XUPXIli8UiyFGE3SFWtrlgXtXBgRKz2q3ZIqWqCRT8rkpSwxX6a26IovaG25FE5RaZKe OVCKd+2ED3WTVGJJ6l4dqKd/XDO0FJmBWZjOdW50j74ajvW7CFYBkgItbIyiwgSx5tsg EF0w== 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 h6-v6si2024961edd.152.2018.06.14.09.40.17; Thu, 14 Jun 2018 09:40: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 BD881C21DB3; Thu, 14 Jun 2018 16:36:10 +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 E9FDFC21E74; Thu, 14 Jun 2018 16:33:44 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 80C4BC21CB6; Thu, 14 Jun 2018 16:33:35 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 8B9EFC21DED for ; Thu, 14 Jun 2018 16:33: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 E050DAF85; Thu, 14 Jun 2018 16:33:34 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Thu, 14 Jun 2018 18:33:34 +0200 Message-Id: <20180614163334.46827-12-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180614163334.46827-1-agraf@suse.de> References: <20180614163334.46827-1-agraf@suse.de> Cc: Heinrich Schuchardt Subject: [U-Boot] [PATCH 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