From patchwork Mon Jun 18 15:23:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 139026 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4094170lji; Mon, 18 Jun 2018 08:35:45 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJuePOGOxihoolpTUcv98KbfVMn5ej2KG5lAm5f1zAWA3swui2qbpBhYXnQgfYQt2eMCFb6 X-Received: by 2002:a50:82c1:: with SMTP id 59-v6mr11499674edg.114.1529336145884; Mon, 18 Jun 2018 08:35:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529336145; cv=none; d=google.com; s=arc-20160816; b=bZSPorzMAhZSbJ96psi+p6P6vkpJrFVN4fjZJdT+b4N4b0faT0cdVgls4L4W9lsuDM mIEfP58vo91FzDh8ch154tFApDUdUl/qmHZoIn393zcbAJyZzTXpEEFEALrqGrK+TOOf 1MfknN4PK9dacW9on79x4hfkb2oOmuegLeEyEbrfgMZmlLHsklxM8eYAOyu1QIBZpU58 lwysa3MXmPt38z05FxaNhRRweneAlzXYmZsiov8iUeiXBGQEFi/obhd+qc6reYYHrOhs vQmI5kx3aIKelSAB0+RichqMcb3fW2Gxw+pNmx5/Wx1NCdm06RhYwD9laTO4yNR1G3tb NJfQ== 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=Mj9oXgbKcliaJ0F1h0IyrkwNPQESdPzi9Sj9X7+HQZw=; b=gGolZwdGqBvogIrMLwH8P+xOszxGKA/QteQPLcU4FxinuI5uN4EDHyJTI8B3CP/Vom wMJlMremVbWS1j5j588ecadK0qv79j8sprkpAAJ2d+UmXAWAwwlJgzqntcqy29Zt7w2m 1GFKMKoIniQS0aL9pfcCf0kaBl+QUmnaj8PkRqx3nJAzhVCmrK5CU9Qnqsi2ORpc0nTy ducnwdNNjFuvfnh34LaPmL6JrxXKkwxwPnP7zKZWVD2j3WY36QWH8VAW1QyEs8Zv7Pq+ W2WKFWko4vyzSRT8i4M3RkBZXjgmBqJtseDaPr0/UEX6Jwm/Zzpti28EZtPETxv/VEiR mu7A== 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 z17-v6si8166372edc.424.2018.06.18.08.35.45; Mon, 18 Jun 2018 08:35:45 -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 621FDC21F06; Mon, 18 Jun 2018 15:26: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 8B301C21EDE; Mon, 18 Jun 2018 15:23:26 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 92033C21E38; Mon, 18 Jun 2018 15:23:18 +0000 (UTC) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by lists.denx.de (Postfix) with ESMTPS id 0361EC21EA2 for ; Mon, 18 Jun 2018 15:23:18 +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 5F3A5AF80; Mon, 18 Jun 2018 15:23:17 +0000 (UTC) From: Alexander Graf To: u-boot@lists.denx.de Date: Mon, 18 Jun 2018 17:23:12 +0200 Message-Id: <20180618152315.34233-19-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 18/21] efi: sandbox: Adjust memory usage 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 With sandbox the U-Boot code is not mapped into the sandbox memory range so does not need to be excluded when allocating EFI memory. Update the EFI memory init code to take account of that. Signed-off-by: Simon Glass [agraf: Remove map_sysmem() call] Signed-off-by: Alexander Graf --- lib/efi_loader/efi_memory.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index ce29bcc6a3..19492df518 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -496,14 +497,13 @@ __weak void efi_add_known_memory(void) } } -int efi_memory_init(void) +/* Add memory regions for U-Boot's memory and for the runtime services code */ +static void add_u_boot_and_runtime(void) { unsigned long runtime_start, runtime_end, runtime_pages; unsigned long uboot_start, uboot_pages; unsigned long uboot_stack_size = 16 * 1024 * 1024; - efi_add_known_memory(); - /* Add U-Boot */ uboot_start = (gd->start_addr_sp - uboot_stack_size) & ~EFI_PAGE_MASK; uboot_pages = (gd->ram_top - uboot_start) >> EFI_PAGE_SHIFT; @@ -516,6 +516,14 @@ int efi_memory_init(void) runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; efi_add_memory_map(runtime_start, runtime_pages, EFI_RUNTIME_SERVICES_CODE, false); +} + +int efi_memory_init(void) +{ + efi_add_known_memory(); + + if (!IS_ENABLED(CONFIG_SANDBOX)) + add_u_boot_and_runtime(); #ifdef CONFIG_EFI_LOADER_BOUNCE_BUFFER /* Request a 32bit 64MB bounce buffer region */