From patchwork Fri Jun 15 12:42:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 138677 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp798268lji; Fri, 15 Jun 2018 05:43:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIigP+Azj2d1iuqgvofx0WyxxVPMry+lVn0AdzhsMtxhn1X4FIPJ6uLNkzqThwSHCDzbNUV X-Received: by 2002:a50:b5a3:: with SMTP id a32-v6mr1773571ede.120.1529066608625; Fri, 15 Jun 2018 05:43:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529066608; cv=none; d=google.com; s=arc-20160816; b=fTpuSzcCA6hdeYZlOpSLjWWeofDdGtvwfSWe5e/2fD5uRLjKjLz+gwYZlWBXoijaVh Q/dG/eMageA2C7WO7NAQbsndbBBPkC1TQ1G7P6nZxtqcG81Jt7SkpxlsYJKMms3pNBOW pWQz2ASEEybBwn2XPpHY57tSaHViS/TiHU49v35PgMjADXzAzElONoce4J6C1UGAOQzR Uso+jhffTEFioMCeaItyK/hz3xOOPwtRzh/xdhwU1vgy7Rn47H7sppjuogHHWSOvdjmj Am7wC7GArjMLFU2BKpU21+nygVdH1sXX1UvHKXiMIg3yQ3yGRP7urlJvmx+iHyFHpLCe zQYw== 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=SRmsmaViDrXjl6X+DN9hRh/SyhsyZnJHzzIQQJiJgps=; b=rqGgrf6v3MzORs2GGqVfsIfms8TKpfCJfoTX0EWSHVP/IyoB9Z5T6Jf6/gwcY3ouvT fB6+d2HLm7ZpxGbfVlRmChpJHIh9kCr06hjmDqqEbKNczer+7KRRR+lh2+l3Wofwlnqn c/x3Ufdn+sLDlzEOsWHFpuS4xhhAVuEri2iy5TG/naFKKlkhtWCgAaJuMXrypY4b8U7U jor4bZmvqGX/Wb87bHhanm9cixjuQ0sSCPD0nSS4cBHE9woyX+MutCVhktDEMyRFJNFf 2VFa6XP8Jj525Qv+n9YKfbWmEvqj/Rxcvqs1YDE0G0FLPtp7fRsJQYs/rNRrCoOFq+Vb Z4qQ== 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-v6si2884599eda.373.2018.06.15.05.43.28; Fri, 15 Jun 2018 05:43: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 06591C21F17; Fri, 15 Jun 2018 12:43:03 +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 46C80C21E68; Fri, 15 Jun 2018 12:42:34 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id C43CBC21DAF; Fri, 15 Jun 2018 12:42:32 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 527B0C21DAF for ; Fri, 15 Jun 2018 12:42:31 +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 DD355AE4F; Fri, 15 Jun 2018 12:42:30 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Fri, 15 Jun 2018 14:42:16 +0200 Message-Id: <20180615124229.35310-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180615124229.35310-1-agraf@suse.de> References: <20180615124229.35310-1-agraf@suse.de> Cc: Andy Shevchenko , Heinrich Schuchardt Subject: [U-Boot] [PATCH v3 04/17] 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);