From patchwork Fri Oct 25 11:14:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 838336 Delivered-To: patch@linaro.org Received: by 2002:adf:e287:0:b0:37d:45d0:187 with SMTP id v7csp210720wri; Fri, 25 Oct 2024 04:15:25 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVtqdYPV+Xrnvxx2GAcrZibJLFydyNUJE3yY1q4jOdE8Fb5QcVmfqWKDeqVy2ZvXUjdIlW5QQ==@linaro.org X-Google-Smtp-Source: AGHT+IEAYFBB5qofzJyFDrMQ7uB7iqlmznWcfwidhwVNis6Oy7hz+PhEWRxWFh1hDIYWstzkBOIr X-Received: by 2002:a05:6512:b19:b0:539:fc45:a292 with SMTP id 2adb3069b0e04-53b1a391e9emr5721693e87.43.1729854924791; Fri, 25 Oct 2024 04:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729854924; cv=none; d=google.com; s=arc-20240605; b=Xv/JMS6vYppdLNmUdudHIw1lyvwwt9ywKUJdk7FjqlttH62D/cHpXV7OlqwoEMPR9W GADh5BzdIbikEiCTLt8e1+jt5L3Qf2kzyYAWq46k4cN38r43j7jZJJGwnx4hCAuaxrGK ySbeox73UXOPIYvLCeZ/vimWLhQRHOdFCLgZQgnmUw0sk08y02QwGnBaCafDC1LO5KId MYY1WTIf69AeCNG3yjz85FGaXZ+W/HMgXjPn3mJsCPM/1uywlj140LewiYBOVxrTdROv wYM+cgf1eUgCCMLhlBPlKY98bR3IF9+tKcCPgL2FscatCZtqnjzL3tGPbDpOhvKFL9Wd wXRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=o0kJDsuHIegwDAD2uQlnrFGPQeqwsE4xt6qmdwAZ1Es=; fh=/d1KoRIHjkZx+hRH68oqSHrQ1CpYp/0CZRePtqVCHZE=; b=Otwjb+naTNqeTQl98NbGmIJR457ZE6TCHJN4ADkoQ/irUlz531afSUnKbudrSULRIK B85hft/em5UDFqCzLUUD3N6tlr6+XX6zEsWbMITh02tHuXbvT0AdA/+KODasZcxYdwI9 ffaV9qrpA2/y6CRtZNiqt9v5LCHWqFe1ZXPW1IUFfUlzRdoC1IOQJ6M7lTvQ8S4cflQL ctK+ymmBL01nKd7clB1jMfN9p9BChepsYtc5hJzkmnJt3aGb8gyWhH5ljjTwr6FltYme 05wTaZnuJxoS7PnHnKewXIGxHeXMslXL+jm7YDojJa/chdNwuH0N9fnBWUUla1ryanBj Lkuw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-53b2e10d346si371165e87.14.2024.10.25.04.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 04:15:24 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2986288FFC; Fri, 25 Oct 2024 13:14:59 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 0195288FE2; Fri, 25 Oct 2024 13:14:58 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 38C0C88ED2 for ; Fri, 25 Oct 2024 13:14:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5539F339; Fri, 25 Oct 2024 04:15:19 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7915D3F73B; Fri, 25 Oct 2024 04:14:47 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Tom Rini , Masahisa Kojima , Sughosh Ganu Subject: [PATCH 1/4] fdt: add support for adding pmem nodes Date: Fri, 25 Oct 2024 16:44:08 +0530 Message-Id: <20241025111411.165904-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025111411.165904-1-sughosh.ganu@linaro.org> References: <20241025111411.165904-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Masahisa Kojima One of the problems OS installers face, when running in EFI, is that the mounted ISO after calling ExitBootServices goes away. For some distros this is a problem since they rely on finding some core packages before continuing the installation. Distros have works around this -- e.g Fedora has a special kernel command line parameter called inst.stage2 [0]. ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we don't have anything in place for DTs. Linux and device trees have support for persistent memory devices. So add a function that can inject a pmem node in a DT, so we can use it when launhing OS installers with EFI. [0] https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/7/html/installation_guide/chap-anaconda-boot-options#sect-boot-options-installer Signed-off-by: Masahisa Kojima Signed-off-by: Sughosh Ganu --- boot/fdt_support.c | 41 +++++++++++++++++++++++++++++++++++++++-- include/fdt_support.h | 13 +++++++++++++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/boot/fdt_support.c b/boot/fdt_support.c index 2392027d40..61f725389b 100644 --- a/boot/fdt_support.c +++ b/boot/fdt_support.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -463,7 +464,6 @@ void do_fixup_by_compat_u32(void *fdt, const char *compat, do_fixup_by_compat(fdt, compat, prop, &tmp, 4, create); } -#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY /* * fdt_pack_reg - pack address and size array into the "reg"-suitable stream */ @@ -491,7 +491,7 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size, return p - (char *)buf; } - +#ifdef CONFIG_ARCH_FIXUP_FDT_MEMORY #if CONFIG_NR_DRAM_BANKS > 4 #define MEMORY_BANKS_MAX CONFIG_NR_DRAM_BANKS #else @@ -2221,3 +2221,40 @@ int fdt_valid(struct fdt_header **blobp) } return 1; } + +int fdt_fixup_pmem_region(void *blob, ulong addr, u32 size) +{ + u64 pmem_start[2] = { 0 }; + u64 pmem_size[2] = { 0 }; + char pmem_node[32] = {0}; + int nodeoffset, len; + int err; + u8 tmp[4 * 16]; /* Up to 64-bit address + 64-bit size */ + + if (!IS_ALIGNED(addr, SZ_2M) || !IS_ALIGNED(addr + size, SZ_2M)) { + printf("Start and end address needs at 2MB alignment\n"); + return -1; + } + snprintf(pmem_node, sizeof(pmem_node), "pmem@%lx", addr); + nodeoffset = fdt_find_or_add_subnode(blob, 0, pmem_node); + if (nodeoffset < 0) + return nodeoffset; + + err = fdt_setprop_string(blob, nodeoffset, "compatible", "pmem-region"); + if (err) + return err; + err = fdt_setprop_empty(blob, nodeoffset, "volatile"); + if (err) + return err; + pmem_start[0] = addr; + pmem_size[0] = size; + len = fdt_pack_reg(blob, tmp, pmem_start, pmem_size, 1); + err = fdt_setprop(blob, nodeoffset, "reg", tmp, len); + if (err < 0) { + printf("WARNING: could not set pmem %s %s.\n", "reg", + fdt_strerror(err)); + return err; + } + + return 0; +} diff --git a/include/fdt_support.h b/include/fdt_support.h index 741e2360c2..63ece0de32 100644 --- a/include/fdt_support.h +++ b/include/fdt_support.h @@ -473,4 +473,17 @@ void fdt_fixup_pstore(void *blob); */ int fdt_kaslrseed(void *blob, bool overwrite); +/** + * fdt_fixup_pmem_region() - add a pmem node on the device tree + * + * This functions injects a pmem node to the device tree. Usually + * used with EFI installers to preserve installer images + * + * @blob: device tree provided by caller + * @addr: start address of the pmem node + * @size: size of the memory of the pmem node + * Return: 0 on success or < 0 on failure + */ +int fdt_fixup_pmem_region(void *blob, ulong addr, u32 size); + #endif /* ifndef __FDT_SUPPORT_H */ From patchwork Fri Oct 25 11:14:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 838335 Delivered-To: patch@linaro.org Received: by 2002:adf:e287:0:b0:37d:45d0:187 with SMTP id v7csp210651wri; Fri, 25 Oct 2024 04:15:15 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWXjft2Ku6PQDhlXg5UJKHMvwuXsCc4XPMJ2xg7Kf+Sz+ddvUSoFYtBN88Eyupx+gHULYIb6w==@linaro.org X-Google-Smtp-Source: AGHT+IHA3L0I6hFxv7wBu+xXhKUzZwokv9RryoU0DRbnT2JKX0h7YXThhfTnnSRVc7RzNmwjhKj5 X-Received: by 2002:a2e:b88b:0:b0:2fa:d354:1435 with SMTP id 38308e7fff4ca-2fc9d1dbb59mr48745591fa.0.1729854915062; Fri, 25 Oct 2024 04:15:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729854915; cv=none; d=google.com; s=arc-20240605; b=MBfYOmSeyoaVg1aqyZzsQUnm1+3Sznpzhk1U00RqyHAM2PJwrKLklduiGRu/BbSAYL hZ4hrH5L/OLQjKuCKdgOxlWkpGD4qAz9JPmF1408Uc98i+Omwus56uVW+aJ9QXNceQze gedsupU6TyAHK7tNHM+AmCknD3NwZMlN3es/pTWySi9Q2HDeRTIgWBvGNETvD0ub7gPp gYBOfw4c5TiDuuWu6M/vbCklayqbBFSuGq1IcH6R5wrdSW5AV7zeXSWeUOWQ/77POSR8 fQgcCOkyzQGpVpnuGnkM4m1OnLMBtruKRRxvplXt2SjH/GQwrf4YX+OmTb9kZBgG3rHr svHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=0DWQL2lcXCw3gvPjQh73yloxOEC/DgW9D5bvcZs/pTI=; fh=u6ljpCS4uZ/kj1Y8Zoinr3YBaBeaYO7JTxZPQgvPhM8=; b=jxPFpipfMCxVY4rwuq1SrhInzuie5DyFem9GJT8isEuiiNE72b1oLqUyCK/2q/uD2s v/2fxeP3quTF87YysnIWQUUdA3GpQXETkCLDErmBfGFo2aAEFMRXylB/OzKw+95uLz0w dLwmsWjZ6Kz8U+L4LKwcZqOa2OfRVSLhnsf6qNpRB+I+Resd7Qv+HmDNGgYzh14bWkbG GO6PGfGPQ7FpSpF3k4sEux6Qr5zujzlfx84tLzzpforlxo2JmPguuOSmdwkYt0epZyqi mXMS4eDjEmNLKvNKNlYLV1XByz7P7dJhRv/BmO2LtV1R8oN2n/4uzw/1xvM4Dj+ry8sX /3UQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 38308e7fff4ca-2fcb45e2543si2926481fa.260.2024.10.25.04.15.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 04:15:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C4BB188FC8; Fri, 25 Oct 2024 13:14:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id E7E8388FC0; Fri, 25 Oct 2024 13:14:54 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 9838A88F47 for ; Fri, 25 Oct 2024 13:14:52 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BEFF7497; Fri, 25 Oct 2024 04:15:21 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 304343F73B; Fri, 25 Oct 2024 04:14:49 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Tom Rini , Sughosh Ganu Subject: [PATCH 2/4] efi_loader: add a function to remove memory from the EFI map Date: Fri, 25 Oct 2024 16:44:09 +0530 Message-Id: <20241025111411.165904-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025111411.165904-1-sughosh.ganu@linaro.org> References: <20241025111411.165904-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Ilias Apalodimas With upcoming changes supporting pmem nodes, we need to ommit the pmem area rfom the EFI memory map. Add a function to do that Signed-off-by: Ilias Apalodimas Signed-off-by: Sughosh Ganu --- include/efi_loader.h | 11 +++++--- lib/efi_loader/efi_memory.c | 51 +++++++++++++++++++++++++++---------- lib/lmb.c | 4 +-- 3 files changed, 47 insertions(+), 19 deletions(-) diff --git a/include/efi_loader.h b/include/efi_loader.h index 291eca5c07..d450e304c6 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -786,7 +786,7 @@ efi_status_t efi_get_memory_map(efi_uintn_t *memory_map_size, efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type); /** - * efi_add_memory_map_pg() - add pages to the memory map + * efi_update_memory_map() - update the memory map by adding/removing pages * * @start: start address, must be a multiple of * EFI_PAGE_SIZE @@ -794,11 +794,14 @@ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type); * @memory_type: type of memory added * @overlap_conventional: region may only overlap free(conventional) * memory + * @remove: remove memory map * Return: status code */ -efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, - int memory_type, - bool overlap_conventional); +efi_status_t efi_update_memory_map(u64 start, u64 pages, int memory_type, + bool overlap_conventional, bool remove); + +/* Remove memory from the EFI memory map */ +efi_status_t efi_remove_memory_map(u64 start, u64 size, int memory_type); /* Called by board init to initialize the EFI drivers */ efi_status_t efi_driver_init(void); diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 3d742fa191..cb93bfa55f 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -258,7 +258,7 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map, } /** - * efi_add_memory_map_pg() - add pages to the memory map + * efi_update_memory_map() - update the memory map by adding/removing pages * * @start: start address, must be a multiple of * EFI_PAGE_SIZE @@ -266,11 +266,11 @@ static s64 efi_mem_carve_out(struct efi_mem_list *map, * @memory_type: type of memory added * @overlap_conventional: region may only overlap free(conventional) * memory + * @remove: remove memory map * Return: status code */ -efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, - int memory_type, - bool overlap_conventional) +efi_status_t efi_update_memory_map(u64 start, u64 pages, int memory_type, + bool overlap_conventional, bool remove) { struct efi_mem_list *lmem; struct efi_mem_list *newlist; @@ -278,9 +278,9 @@ efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, uint64_t carved_pages = 0; struct efi_event *evt; - EFI_PRINT("%s: 0x%llx 0x%llx %d %s\n", __func__, + EFI_PRINT("%s: 0x%llx 0x%llx %d %s %s\n", __func__, start, pages, memory_type, overlap_conventional ? - "yes" : "no"); + "yes" : "no", remove ? "remove" : "add"); if (memory_type >= EFI_MAX_MEMORY_TYPE) return EFI_INVALID_PARAMETER; @@ -363,7 +363,10 @@ efi_status_t efi_add_memory_map_pg(u64 start, u64 pages, } /* Add our new map */ - list_add_tail(&newlist->link, &efi_mem); + if (!remove) + list_add_tail(&newlist->link, &efi_mem); + else + free(newlist); /* And make sure memory is listed in descending order */ efi_mem_sort(); @@ -400,7 +403,29 @@ efi_status_t efi_add_memory_map(u64 start, u64 size, int memory_type) pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK)); start &= ~EFI_PAGE_MASK; - return efi_add_memory_map_pg(start, pages, memory_type, false); + return efi_update_memory_map(start, pages, memory_type, false, false); +} + +/** + * efi_remove_memory_map() - remove memory area to the memory map + * + * @start: start address of the memory area + * @size: length in bytes of the memory area + * @memory_type: type of memory removed + * + * Return: status code + * + * This function automatically aligns the start and size of the memory area + * to EFI_PAGE_SIZE. + */ +efi_status_t efi_remove_memory_map(u64 start, u64 size, int memory_type) +{ + u64 pages; + + pages = efi_size_in_pages(size + (start & EFI_PAGE_MASK)); + start &= ~EFI_PAGE_MASK; + + return efi_update_memory_map(start, pages, memory_type, false, true); } /** @@ -500,7 +525,7 @@ efi_status_t efi_allocate_pages(enum efi_allocate_type type, addr = (u64)(uintptr_t)map_sysmem(addr, 0); /* Reserve that map in our memory maps */ - ret = efi_add_memory_map_pg(addr, pages, memory_type, true); + ret = efi_update_memory_map(addr, pages, memory_type, true, false); if (ret != EFI_SUCCESS) /* Map would overlap, bail out */ return EFI_OUT_OF_RESOURCES; @@ -542,8 +567,8 @@ efi_status_t efi_free_pages(uint64_t memory, efi_uintn_t pages) if (status) return EFI_NOT_FOUND; - ret = efi_add_memory_map_pg(memory, pages, EFI_CONVENTIONAL_MEMORY, - false); + ret = efi_update_memory_map(memory, pages, EFI_CONVENTIONAL_MEMORY, + false, false); if (ret != EFI_SUCCESS) return EFI_NOT_FOUND; @@ -828,8 +853,8 @@ static void add_u_boot_and_runtime(void) runtime_end = (uintptr_t)__efi_runtime_stop; runtime_end = (runtime_end + runtime_mask) & ~runtime_mask; runtime_pages = (runtime_end - runtime_start) >> EFI_PAGE_SHIFT; - efi_add_memory_map_pg(runtime_start, runtime_pages, - EFI_RUNTIME_SERVICES_CODE, false); + efi_update_memory_map(runtime_start, runtime_pages, + EFI_RUNTIME_SERVICES_CODE, false, false); } int efi_memory_init(void) diff --git a/lib/lmb.c b/lib/lmb.c index 7e90f17876..05f3cd093d 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -55,11 +55,11 @@ static int __maybe_unused lmb_map_update_notify(phys_addr_t addr, pages = efi_size_in_pages(size + (efi_addr & EFI_PAGE_MASK)); efi_addr &= ~EFI_PAGE_MASK; - status = efi_add_memory_map_pg(efi_addr, pages, + status = efi_update_memory_map(efi_addr, pages, op == MAP_OP_RESERVE ? EFI_BOOT_SERVICES_DATA : EFI_CONVENTIONAL_MEMORY, - false); + false, false); if (status != EFI_SUCCESS) { log_err("%s: LMB Map notify failure %lu\n", __func__, status & ~EFI_ERROR_MASK); From patchwork Fri Oct 25 11:14:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 838337 Delivered-To: patch@linaro.org Received: by 2002:adf:e287:0:b0:37d:45d0:187 with SMTP id v7csp210811wri; Fri, 25 Oct 2024 04:15:39 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXfCPslo5JyXGPOzMl8Bax9mPIF3wBq1jFy9B7QNFaDGLcMkfCQDNLgD6YM8HKg/3shx9Z3hw==@linaro.org X-Google-Smtp-Source: AGHT+IERMDmoAxPunIjExLTRfQdJB2eJl3ZcoexbKs2FbgMl9u8aMTQ3wRVI9e5eBhvYnemm9XH6 X-Received: by 2002:a2e:be9f:0:b0:2fb:955e:5c17 with SMTP id 38308e7fff4ca-2fc9d5e5bc2mr53915701fa.40.1729854939052; Fri, 25 Oct 2024 04:15:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729854939; cv=none; d=google.com; s=arc-20240605; b=PHFA7YPtnmFBT2Q1k2jFC3qlb5rDgJQjfktRY6sapBkr/54QfhYihl2vXGH4tryy8i idvs/wtLNeKkq7FM3P1TEnnZB07FcXr22kRCyghiRZVDJTGjpjo319CbSGx0yncGY8Md Fd/HgcXtJHUX5My6V9tL5us36t/FAZgMStdjBU8+0whBj77hB5t7IOS2LraKBrLaOazr yTGvQ2f27tpnJEoVviRrXHO8oePsQmAcNUEblP176Gn5vi4pgDmG9DG8+XxU8/AEA3Yv TrNg1DllSSA7ESdTDAo8ukN1IIBi9VjpeyBx0kyp/bHPBfG/Ys0RIgG1y1K7X5jpdKJI r0Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Rt4MAL6XI+osu7NM0mLBmrxUTxCqC8LCJDvlHmCsfLU=; fh=u6ljpCS4uZ/kj1Y8Zoinr3YBaBeaYO7JTxZPQgvPhM8=; b=EpXmykvmMI5JFIOOOdsfE9vZWBhozT/8l2S5MGmBze5O5yYj2TJnyplrh5hyZrFC2Y 24PQ/PuETeuvkJynvVdtUlFFvreMLqRCwUm1kBnrjomGYOFRsHz3fFBglSRdTvfgUwiV R2dFlz/lnbVtv+QZyGjJ3nhVOzgr6Hz4Giv4OY/sMIXx7S6Gu8b0oz5rbPs8br1M2k/Y bejSdThRNCebANm+sWNHyXl2wkuxndoshR/AJqUD3L0HeREl2k7bbzeReqy/JSo4tYrL kwhCTD6Ee0LDqTrCvzuwjxJjuMqsSkrs5O9iVHKLOFTWDMDtyK95LUHurfVf4fVtWYGT lV6w==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 38308e7fff4ca-2fcb4636e41si2806971fa.551.2024.10.25.04.15.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 04:15:39 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C439189016; Fri, 25 Oct 2024 13:15:04 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 350B889001; Fri, 25 Oct 2024 13:14:59 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,SPF_SOFTFAIL autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 0FFF888F47 for ; Fri, 25 Oct 2024 13:14:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 349D5497; Fri, 25 Oct 2024 04:15:24 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 9A4BD3F73B; Fri, 25 Oct 2024 04:14:52 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Tom Rini , Sughosh Ganu Subject: [PATCH 3/4] efi_loader: preserve installer images in pmem Date: Fri, 25 Oct 2024 16:44:10 +0530 Message-Id: <20241025111411.165904-4-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025111411.165904-1-sughosh.ganu@linaro.org> References: <20241025111411.165904-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean From: Ilias Apalodimas One of the problems OS installers face, when running in EFI, is that the mounted ISO after calling ExitBootServices goes away. For some distros this is a problem since they rely on finding some core packages before continuing the installation. Distros have works around this -- e.g Fedora has a special kernel command line parameter called inst.stage2 [0]. ACPI has NFIT and NVDIMM support to provide ramdisks to the OS, but we don't have anything in place for DTs. Linux and device trees have support for persistent memory devices. It's worth noting that for linux to instantiate the /dev/pmemX device, the memory described in the pmem node has to be omitted from the EFI memory map we hand over to the OS if ZONE_DEVICES and SPARSEMEM is enabled. With those enabled the pmem driver ends up calling devm_memremap_pages() instead of devm_memremap(). The latter works whether the memory is omitted or marked as reserved, but mapping pages only works if the memory is omitted. On top of that, depending on how the kernel is configured, that memory area must be page aligned or 2MB aligned. PowerPC is an exception here and requires 16MB alignment, but since we don't have EFI support for it, limit the alignment to 2MB. Ensure that the ISO image is 2MB aligned and remove the region occupied by the image from the EFI memory map. Signed-off-by: Ilias Apalodimas Signed-off-by: Sughosh Ganu --- lib/efi_loader/efi_bootmgr.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index a3aa2b8d1b..16f75555f6 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -18,6 +18,8 @@ #include #include #include +#include +#include static const struct efi_boot_services *bs; static const struct efi_runtime_services *rs; @@ -358,13 +360,16 @@ static efi_status_t prepare_loaded_image(u16 *label, ulong addr, ulong size, } /* - * TODO: expose the ramdisk to OS. - * Need to pass the ramdisk information by the architecture-specific - * methods such as 'pmem' device-tree node. + * Linux supports 'pmem' which allows OS installers to find, reclaim + * the mounted images and continue the installation since the contents + * of the pmem region are treated as local media. + * + * The memory regions used for it needs to be carved out of the EFI + * memory map. */ - ret = efi_add_memory_map(addr, size, EFI_RESERVED_MEMORY_TYPE); + ret = efi_remove_memory_map(addr, size, EFI_CONVENTIONAL_MEMORY); if (ret != EFI_SUCCESS) { - log_err("Memory reservation failed\n"); + log_err("Failed to reserve memory\n"); goto err; } @@ -486,6 +491,13 @@ static efi_status_t try_load_from_uri_path(struct efi_device_path_uri *uridp, ret = EFI_INVALID_PARAMETER; goto err; } + /* + * Depending on the kernel configuration, pmem memory area must be page + * aligned or 2MB aligned. PowerPC is an exception here and requires + * 16MB alignment, but since we don't have EFI support for it, limit + * the alignment to 2MB. + */ + image_size = ALIGN(image_size, SZ_2M); /* * If the file extension is ".iso" or ".img", mount it and try to load From patchwork Fri Oct 25 11:14:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 838338 Delivered-To: patch@linaro.org Received: by 2002:adf:e287:0:b0:37d:45d0:187 with SMTP id v7csp210906wri; Fri, 25 Oct 2024 04:15:53 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUFu+8I353nd3Qzo0yJLk9k3xO4jJrTgCViUEc9Rct6zAYDIQrsTYUkZe0QGBbrqlDhzU13cg==@linaro.org X-Google-Smtp-Source: AGHT+IF2Ygl2l1ZyzcLTR2QjvtfDoDsofHH2yirM82+U6uxl38eUB8OxoxHopksucDGDxO+nYOtF X-Received: by 2002:a05:6512:31cd:b0:539:edbe:ac86 with SMTP id 2adb3069b0e04-53b23dde45cmr3543114e87.10.1729854953639; Fri, 25 Oct 2024 04:15:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1729854953; cv=none; d=google.com; s=arc-20240605; b=Cxg5/LgQGoYU6Mlk9BoMeML4GRdzoYRIf08dC1ignTI4iMXDApdRKrPiVmLWDeL3cZ sJwZfsHbXQEEaGi9rvLtxhSCo66q0SdMfTGqhblfmPAWwBszD4iz2XByY0TauFT1pScK S30F9a3b4CO9AvYR7UQd3T+Tp0ixPWHn4BZ87KyAVUCALjvTHJPoMKDSifbMIpmPEE9M txm5U5hdOJEBdzF3YV2PbuAalQUv6Kdoyhxs/BzT3wMYRrMAw1FSNyyGXre8RI0bRjZm Fyqx+CgawzqgiozcxoGq3+qGfoX89JAPCIOG+TPwulYlVluzWxNSirjFAGqfN3GvNtYf e2cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=Tm+eRBNyRsfLEf5ySiN01WtiIPPkERntHl+7958ngkg=; fh=u6ljpCS4uZ/kj1Y8Zoinr3YBaBeaYO7JTxZPQgvPhM8=; b=goonU6tNWGxDE2nXPG7G/QtZ4Ixv/xRI5y2AKLoQQSN/rYqaTtsNuudqvXi1F/nv4+ AwjWbap3lSoGCqbeGwswavQ5Cg+5GLbZ9x0koxcgRtqChMGfd2ceFQgE56ED8dCMRTZ/ w/iTiw4RK3S+cAuRBr3NMpxy+2B/cdLYfOtyjCysfv/gtZwxYm/+Nb1jHi4mA4J3+LK0 QmVcVVcey1xcGqic3WdbnoBFVZnTDRZsLw9ACYk6mwfCynWzRhLjACaNxFNPo605E+dZ iA28ZwRZcb8tiORsav3OjiN4wLOfT1g0FaXfcC5l3TY8xnlDt2wUKAHXZFlME1WZzaYm WUAQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id 2adb3069b0e04-53b2e1b082bsi366823e87.252.2024.10.25.04.15.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Oct 2024 04:15:53 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6BDFD88F94; Fri, 25 Oct 2024 13:15:13 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 44BAC88F94; Fri, 25 Oct 2024 13:15:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE,T_SPF_TEMPERROR autolearn=ham autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 807EB88BEF for ; Fri, 25 Oct 2024 13:14:57 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9EA83339; Fri, 25 Oct 2024 04:15:26 -0700 (PDT) Received: from a079122.blr.arm.com (a079122.arm.com [10.162.17.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1014D3F73B; Fri, 25 Oct 2024 04:14:54 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Heinrich Schuchardt , Tom Rini , Sughosh Ganu Subject: [PATCH 4/4] efi: add helper functions to insert pmem node for DT fixup Date: Fri, 25 Oct 2024 16:44:11 +0530 Message-Id: <20241025111411.165904-5-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241025111411.165904-1-sughosh.ganu@linaro.org> References: <20241025111411.165904-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean The EFI HTTP boot puts the iso installer image at some location in memory which needs to be reserved in the devicetree as persistent memory (pmem). Add helper functions which add this pmem node when the EFI_DT_FIXUP protocol's fixup callback is invoked. Signed-off-by: Sughosh Ganu --- boot/image-fdt.c | 9 +++++++++ include/efi_loader.h | 17 +++++++++++++++++ lib/efi_loader/efi_bootmgr.c | 21 +++++++++++++++++++++ lib/efi_loader/efi_helper.c | 12 ++++++++++++ 4 files changed, 59 insertions(+) diff --git a/boot/image-fdt.c b/boot/image-fdt.c index 8eda521693..b39e81ad30 100644 --- a/boot/image-fdt.c +++ b/boot/image-fdt.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -648,6 +649,14 @@ int image_setup_libfdt(struct bootm_headers *images, void *blob, bool lmb) if (!ft_verify_fdt(blob)) goto err; + if (CONFIG_IS_ENABLED(EFI_HTTP_BOOT)) { + fdt_ret = fdt_efi_pmem_setup(blob); + if (fdt_ret) { + printf("ERROR: HTTP boot pmem fixup failed\n"); + goto err; + } + } + /* after here we are using a livetree */ if (!of_live_active() && CONFIG_IS_ENABLED(EVENT)) { struct event_ft_fixup fixup; diff --git a/include/efi_loader.h b/include/efi_loader.h index d450e304c6..031de18746 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -748,6 +748,15 @@ bool efi_varname_is_load_option(u16 *var_name16, int *index); efi_status_t efi_next_variable_name(efi_uintn_t *size, u16 **buf, efi_guid_t *guid); +/** + * fdt_efi_pmem_setup() - Setup the pmem node in the devicetree + * + * @fdt: Pointer to the devicetree + * + * Return: 0 on success, negative on failure + */ +int fdt_efi_pmem_setup(void *fdt); + /** * efi_size_in_pages() - convert size in bytes to size in pages * @@ -964,6 +973,14 @@ efi_status_t efi_set_load_options(efi_handle_t handle, void *load_options); efi_status_t efi_bootmgr_load(efi_handle_t *handle, void **load_options); +/** + * efi_bootmgr_pmem_setup() - Put a pmem node for UEFI HTTP installers + * + * @fdt: Pointer to the DT blob + * Return: status code + */ +efi_status_t efi_bootmgr_pmem_setup(void *fdt); + /** * struct efi_image_regions - A list of memory regions * diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c index 16f75555f6..1d9246be61 100644 --- a/lib/efi_loader/efi_bootmgr.c +++ b/lib/efi_loader/efi_bootmgr.c @@ -41,6 +41,8 @@ struct uridp_context { efi_handle_t mem_handle; }; +static struct uridp_context *uctx; + const efi_guid_t efi_guid_bootmenu_auto_generated = EFICONFIG_AUTO_GENERATED_ENTRY_GUID; @@ -423,6 +425,7 @@ efi_status_t efi_bootmgr_release_uridp(struct uridp_context *ctx) efi_free_pool(ctx->loaded_dp); free(ctx); + uctx = NULL; return ret == EFI_SUCCESS ? ret2 : ret; } @@ -443,6 +446,23 @@ static void EFIAPI efi_bootmgr_http_return(struct efi_event *event, EFI_EXIT(ret); } +/** + * efi_bootmgr_pmem_setup() - Put a pmem node for UEFI HTTP installers + * + * @fdt: Pointer to the DT blob + * Return: status code + */ +efi_status_t efi_bootmgr_pmem_setup(void *fdt) +{ + if (!uctx) { + log_warning("No EFI HTTP boot context found\n"); + return EFI_SUCCESS; + } + + return !fdt_fixup_pmem_region(fdt, uctx->image_addr, uctx->image_size) ? + EFI_SUCCESS : EFI_INVALID_PARAMETER; +} + /** * try_load_from_uri_path() - Handle the URI device path * @@ -472,6 +492,7 @@ static efi_status_t try_load_from_uri_path(struct efi_device_path_uri *uridp, if (!ctx) return EFI_OUT_OF_RESOURCES; + uctx = ctx; s = env_get("loadaddr"); if (!s) { log_err("Error: loadaddr is not set\n"); diff --git a/lib/efi_loader/efi_helper.c b/lib/efi_loader/efi_helper.c index 00167bd2a1..33cd8b9a50 100644 --- a/lib/efi_loader/efi_helper.c +++ b/lib/efi_loader/efi_helper.c @@ -242,6 +242,18 @@ int efi_unlink_dev(efi_handle_t handle) return 0; } +/** + * fdt_efi_pmem_setup() - Setup the pmem node in the devicetree + * + * @fdt: Pointer to the devicetree + * + * Return: 0 on success, negative on failure + */ +int fdt_efi_pmem_setup(void *fdt) +{ + return efi_bootmgr_pmem_setup(fdt) == EFI_SUCCESS ? 0 : -1; +} + static int u16_tohex(u16 c) { if (c >= '0' && c <= '9')