From patchwork Mon Jun 18 15:22:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139000 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4082546lji; Mon, 18 Jun 2018 08:24:22 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJUh1HraqFnL1fgzDmmIjyjnL/6EEJCKaABt2SU5vspHiilhKU7tm0URuUUFqKoJGPQov7j X-Received: by 2002:a50:b223:: with SMTP id o32-v6mr11523252edd.184.1529335462000; Mon, 18 Jun 2018 08:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529335461; cv=none; d=google.com; s=arc-20160816; b=HtcFijPjTyNuH+xR0mquIpLx8969gI8Js1V9SyqaQoWXrNFFnAU4iDZCk5aXkjWWUe aY2Ja/muBKfStbs4dyY89M5ckiIUNEIHmLxZBz4o7zTRLMQHWGxSnuYWU58/b9mMEgf2 FvF87pS0RI2tnm4GgWuIvQh9CsqNJwp+hPfh69wFw2CKflp3ufY3Z96QTxt/3qgtgA9j kN3YppAzQjGC+DcqGR+BbdI6Ng7/WwanumJhNgobGaicGSQDn61Ll+qhOp08n4BV1cV0 +P25W/fSTFKgPdFjsWeTsO5NSpPF/wE6F7pj6xzbk/ekCkAB4mWCWORkZCtKMavQ1UUG qUFQ== 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=fA8j5HjwUACxouqYxiu7mZj2mJDWFR/c6xLTmgE1Uf2FdzBvRUUFHjqcAsXuaUiqZ7 5zaabDoVq2xFGwhBDQ19iCF7MPlbUGx9p68TMtIbJK8Vkxb3nkjrqwKFDVSS6HBVm6i2 Eq7tKQTyKwZGHHnGkOtpny8kdTNu60FSMORzrhaO/gsd6djtDjkk0lEirtsXJ0a0OJ39 ju08sKpZgyyOZiofuYpQaBMsaO3MFv7V4iBC3WzR+AkH/D6Orydp+d9oZ+jILDK2t9/M 5PR8hs7JwkTzuJdl/lcgfD3aVpTp3gsMGVBcWM0+Zmt+3PDEht1B76le4HeFak2ULewi lqIg== 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-v6si9559324edx.74.2018.06.18.08.24.21; Mon, 18 Jun 2018 08:24:21 -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 7E6E5C21EF7; Mon, 18 Jun 2018 15:24:02 +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 9EA4BC21ECC; Mon, 18 Jun 2018 15:23:20 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id D46B9C21E6C; Mon, 18 Jun 2018 15:23:17 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 6ADE2C21DFD for ; Mon, 18 Jun 2018 15:23:17 +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 C3C3CAF68; Mon, 18 Jun 2018 15:23:16 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 18 Jun 2018 17:22:58 +0200 Message-Id: <20180618152315.34233-5-agraf@suse.de> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20180618152315.34233-1-agraf@suse.de> References: <20180618152315.34233-1-agraf@suse.de> Cc: Heinrich Schuchardt , Andy Shevchenko Subject: [U-Boot] [PATCH v4 04/21] 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);