From patchwork Sun Nov 20 00:21:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 627130 Delivered-To: patch@linaro.org Received: by 2002:a17:522:c983:b0:460:3032:e3c4 with SMTP id kr3csp964976pvb; Sat, 19 Nov 2022 16:22:57 -0800 (PST) X-Google-Smtp-Source: AA0mqf7zw8YOjMNsJN25R39QMHx7D4JbabpSVmjn7id7xLXtOshvICt+OCQOKoZbtaAyxi6EO1YG X-Received: by 2002:a67:c792:0:b0:3aa:9c4:a9a9 with SMTP id t18-20020a67c792000000b003aa09c4a9a9mr6573926vsk.75.1668903777185; Sat, 19 Nov 2022 16:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668903777; cv=none; d=google.com; s=arc-20160816; b=ovIqG9lnQAZcmNWFiJriuFwssWXGLok9DuuE7L9v7mFuTUN0+/2wB56mS2Y/TqE/+J /xVBzogamiYq46XvyywComp2Y0+RtjUQ23EGbVBLjEtq+GiEbjlSsqfsd7WwKGJYDFoI we9A0hpvLIS6Tz9oGwEmoJXWVHO5jxiu9M6Nb92UDyoK0RvjX5GjrEa35zFhqo1CN1Yk 3mgqnCFQRlaB4eSUB+wGOwTrI+vpPPEghTIHPr6eMW3df0aFWK5/c5rvmfz+4MsEGeXs 3xQlAO3m5J+0QqG/E57vgjBBUlXjIgbSCm2eQoUtmSeYpPd1ZzDmIXVVbpCEXH4zFmfq GrXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=K9sEtQGAU0NyD1CDWKxxn4/zMQbFiZkCuFZVH+/VzYGM0ihD302b0cVH0RidZfNLk8 mZGUSFFV0WkB20WsNn7mCuOI2iVJSYjiL9ekB5jXBH3GlCBSQpdTnrWQUQ96dguf9J1E U28ryUBIeA4AU6a676z5IPum2GWZY1JTiYYvAourNCHk7+EHvPgt5FBW5hU6d+Z/GgCp gOm5xF1ERqhy15OHfaqtUw/VkrdclNNtWQkqRij9XzeYmnKsf9SJ6Y6IUhZJqOGkaD6+ qY5MR5AY/Jc5ASFzSC9CggMvs2pxzrbCIxpKqS6jkLaiyLho/G4PVBgWHPK02IatAecB Skew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZFFMbXh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id f185-20020a676ac2000000b003a79b937aaasi1278319vsc.329.2022.11.19.16.22.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:22:57 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SZFFMbXh; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (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 64256851EF; Sun, 20 Nov 2022 01:22:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="SZFFMbXh"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 94EA08504C; Sun, 20 Nov 2022 01:22:08 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 7C09F85071 for ; Sun, 20 Nov 2022 01:22:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=masahisa.kojima@linaro.org Received: by mail-pf1-x430.google.com with SMTP id y13so8240350pfp.7 for ; Sat, 19 Nov 2022 16:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=SZFFMbXhPYxkGldKdsMd876i39x2n/CyEjE4oIDky0ivVMjhRXzRBBMEQ3VnnnCqec 7NlScaKd6cLLmvdt2w/Ti+H0eDdkbAZEeCHy7pLmr0LfgMRzjtxvGOak2g1pe2k1Mofp 5KnkSq+rFGdPdmQxJL+xNWipeVeNI5vffe/QNy7UOIRE7fIjplP7ab86oq4c8xGnDOP3 nZVh9Q7Pa52YqWvpoe6LKz/OjADOFN+F3G5kpbUnBCOZsw35okuuLOpevY8Kn8OXygwY XCO5GUWNEYR6zuM757YjksZgwCRSEterR/h+o30GiZCn2aLuBekiu0SXnyyFrqzrs/ry zhhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WBEwQTLrfI6CeA9rJ1AjihoNc79KjDlifSaf3i0vSMA=; b=JPhdUr3AmjD/sniz8OzPutOaJOdtZYYQbbOMwhIWq3yNH96bybwT66vgBktb89EEfI uQMZ+qfumH8MacU322gEfMf0h5jlzW+KeLFN7BoO/9Nq5SRJZWyxQDsTgQ9HejWGniNQ 7DAXdaqcq56vchGR/jlcXtADX/LmxY2M/pX/3VqNLxf2BpFOzs7xAYP7oE8zihOtsRkm yIYffcjyD4yYcreqn+VAS1U2H3PxCTpAP7tJl5XJRB6FLXD4MOiJQT2T0XQlz7yfzj5p frAY0g2CS3CG/pm3D1oNXhymAy3goz1S83f6PGZWlbfYVcGjy3RLJgz+Qun5mxecbgA4 A+HA== X-Gm-Message-State: ANoB5pmXP+j55spedrzhPU0hiou7tUs5ycPXPZtq1g3RwGh2aOzkqHMB rMb0rmVzl9cWm+xmAKPd2sprU0l+O+gDDQ== X-Received: by 2002:a05:6a00:4286:b0:56d:3de3:c525 with SMTP id bx6-20020a056a00428600b0056d3de3c525mr2301781pfb.41.1668903720470; Sat, 19 Nov 2022 16:22:00 -0800 (PST) Received: from localhost.localdomain ([240d:1a:cf7:5800:82fa:5bff:fe4b:26b1]) by smtp.gmail.com with ESMTPSA id d12-20020a170902654c00b00168dadc7354sm1859431pln.78.2022.11.19.16.21.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 16:21:59 -0800 (PST) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Etienne Carriere , Masahisa Kojima Subject: [PATCH v10 4/7] eficonfig: expose eficonfig_create_device_path() Date: Sun, 20 Nov 2022 09:21:16 +0900 Message-Id: <20221120002119.23683-5-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221120002119.23683-1-masahisa.kojima@linaro.org> References: <20221120002119.23683-1-masahisa.kojima@linaro.org> 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.6 at phobos.denx.de X-Virus-Status: Clean Following commits are adding support for UEFI variable management via the eficonfig menu. Those functions needs to use eficonfig_create_device_path() to construct the full device path from device path of the volume and file path, so move it out of their static declarations. Signed-off-by: Masahisa Kojima --- Newly created in v10 cmd/eficonfig.c | 20 +++++++++++--------- include/efi_config.h | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/cmd/eficonfig.c b/cmd/eficonfig.c index 12babb76c2..58a6856666 100644 --- a/cmd/eficonfig.c +++ b/cmd/eficonfig.c @@ -436,14 +436,15 @@ static efi_status_t eficonfig_volume_selected(void *data) } /** - * create_selected_device_path() - create device path + * eficonfig_create_device_path() - create device path * - * @file_info: pointer to the selected file information + * @dp_volume: pointer to the volume + * @current_path: pointer to the file path u16 string * Return: * device path or NULL. Caller must free the returned value */ -static -struct efi_device_path *create_selected_device_path(struct eficonfig_select_file_info *file_info) +struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_volume, + u16 *current_path) { char *p; void *buf; @@ -452,7 +453,7 @@ struct efi_device_path *create_selected_device_path(struct eficonfig_select_file struct efi_device_path_file_path *fp; fp_size = sizeof(struct efi_device_path) + - ((u16_strlen(file_info->current_path) + 1) * sizeof(u16)); + ((u16_strlen(current_path) + 1) * sizeof(u16)); buf = calloc(1, fp_size + sizeof(END)); if (!buf) return NULL; @@ -461,13 +462,13 @@ struct efi_device_path *create_selected_device_path(struct eficonfig_select_file fp->dp.type = DEVICE_PATH_TYPE_MEDIA_DEVICE, fp->dp.sub_type = DEVICE_PATH_SUB_TYPE_FILE_PATH, fp->dp.length = (u16)fp_size; - u16_strcpy(fp->str, file_info->current_path); + u16_strcpy(fp->str, current_path); p = buf; p += fp_size; *((struct efi_device_path *)p) = END; - dp = efi_dp_append(file_info->dp_volume, (struct efi_device_path *)buf); + dp = efi_dp_append(dp_volume, (struct efi_device_path *)buf); free(buf); return dp; @@ -1472,7 +1473,8 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo } if (bo->initrd_info.dp_volume) { - dp = create_selected_device_path(&bo->initrd_info); + dp = eficonfig_create_device_path(bo->initrd_info.dp_volume, + bo->initrd_info.current_path); if (!dp) { ret = EFI_OUT_OF_RESOURCES; goto out; @@ -1481,7 +1483,7 @@ static efi_status_t eficonfig_edit_boot_option(u16 *varname, struct eficonfig_bo efi_free_pool(dp); } - dp = create_selected_device_path(&bo->file_info); + dp = eficonfig_create_device_path(bo->file_info.dp_volume, bo->file_info.current_path); if (!dp) { ret = EFI_OUT_OF_RESOURCES; goto out; diff --git a/include/efi_config.h b/include/efi_config.h index 064f2efe3f..934de41e85 100644 --- a/include/efi_config.h +++ b/include/efi_config.h @@ -99,5 +99,7 @@ efi_status_t eficonfig_append_menu_entry(struct efimenu *efi_menu, char *title, eficonfig_entry_func func, void *data); efi_status_t eficonfig_append_quit_entry(struct efimenu *efi_menu); +struct efi_device_path *eficonfig_create_device_path(struct efi_device_path *dp_volume, + u16 *current_path); #endif