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);