From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5E2E7C433F5 for ; Wed, 23 Mar 2022 07:50:40 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 540EC80F78; Wed, 23 Mar 2022 08:50:36 +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="S/MPHL48"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D339783BEF; Wed, 23 Mar 2022 08:50:34 +0100 (CET) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) (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 0490D83B11 for ; Wed, 23 Mar 2022 08:50:31 +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=takahiro.akashi@linaro.org Received: by mail-pj1-x1035.google.com with SMTP id l4-20020a17090a49c400b001c6840df4a3so1011433pjm.0 for ; Wed, 23 Mar 2022 00:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=pmr6fD11ZwpGBlWy0GsmvrFD8hK91CH2Eyzm/zTz/X8=; b=S/MPHL48T99QT2oO1y/24eAg78BLiE8TekXz/uFCUDpgneFyPYqQeE0gHLc8mwwsw1 Bn9emoAS4a8NtB988UQaaeMHyaKqFTgGVGuGg2bb7tKdkCjqeSwTSeanmy6XODp4xHFd ur8kFIbRhCGeQvGGJQkk5rzmxMbEawgVBBogqWUZimffBoUBNvmB2CrZbmvpWuH6fIgS /CuuBj2lpzO47zsjICjicox9+BSN4J7crt2lvohHbwIqiC7X6KoXKhaycG9nCUXabJ2h J0nYEUz7cJYGrDwm/VsBp1mW6wejFHMcNvVaPVxHHFGlT4cy5rcvCcQlDhWbxuQx39kH L2Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=pmr6fD11ZwpGBlWy0GsmvrFD8hK91CH2Eyzm/zTz/X8=; b=QaqjRfxIIgK/y7GYBUXSs+0ng98BuyJ7Wx0ARA2ro8nvBRP3C4fJVofpiXedM1W/Zf EPdrEbxoI1FK/6OpfE0F5HJ+ZdBvalJ3rgk00XpemqioC94Tc2afEUeNPzolNCE3cPHQ omiVnRaWtAkxlUotgclMn9Z4CSDNgyTRzz/YcPqWU6WKp34Pp6iV01ZP3QJPixcD6VbB vF6cHozqGDjLHZ9tK53qMkpXIdbJdRdi5ZWfb9zUL1BFBgLhJCKmjDF2hIulAiu4+mLM egl8zXGW7NYtwJt9Gtp/mDm+cPEzdDk9fRdj1syggiiQb4wU4gzfpXbdxHuaoMonGzRa 0SEA== X-Gm-Message-State: AOAM533LzT4tmOIaixuUbp93qMb3KS9K3I7/cJaR96K9t4oyHKn4croG U23MN9FsVx1EcApN6Tp76JbM2A== X-Google-Smtp-Source: ABdhPJxjTjh8HFbJkFanWtexHCuFPclGMzc2+8tOLgWfu2FyuumBKQZVs1UgPkUXODIstcznsSUORA== X-Received: by 2002:a17:902:9a4c:b0:14d:b0c0:1f7a with SMTP id x12-20020a1709029a4c00b0014db0c01f7amr21875730plv.57.1648021829398; Wed, 23 Mar 2022 00:50:29 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:2199:5d47:ea3f:788f]) by smtp.gmail.com with ESMTPSA id h13-20020a056a00230d00b004f427ffd485sm28476491pfh.143.2022.03.23.00.50.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Mar 2022 00:50:29 -0700 (PDT) Date: Wed, 23 Mar 2022 16:50:26 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: u-boot@lists.denx.de, Ilias Apalodimas Subject: Re: [PATCH v2 4/9] efi_loader: support booting via short-form device-path Message-ID: <20220323075026.GF49108@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , u-boot@lists.denx.de, Ilias Apalodimas References: <20220319091148.142036-1-heinrich.schuchardt@canonical.com> <20220319091148.142036-5-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220319091148.142036-5-heinrich.schuchardt@canonical.com> 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.5 at phobos.denx.de X-Virus-Status: Clean On Sat, Mar 19, 2022 at 10:11:43AM +0100, Heinrich Schuchardt wrote: > The boot manager must support loading from boot options using a short-form > device-path, e.g. one where the first element is a hard drive media path. > > See '3.1.2 Load Options Processing' in UEFI specification version 2.9. Thank you for adding this feature. Just reminder; a hard drive media path is not the only case for allowing short-form paths. In particular, booting from a short-form path starting with a *file path* device path is also, in my opinion, valuable. So we should have some description, in the commit message or the comment, about this sort of limitation or TODO in handling short-form paths even after this commit. > Fixes: 0e074d12393b ("efi_loader: carve out efi_load_image_from_file()") > Signed-off-by: Heinrich Schuchardt > --- > v2: > path correct remaining paths to LOAD_FILE(2) protocol > --- > lib/efi_loader/efi_boottime.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c > index a7bc371f54..5bcb8253ed 100644 > --- a/lib/efi_loader/efi_boottime.c > +++ b/lib/efi_loader/efi_boottime.c > @@ -1940,7 +1940,7 @@ efi_status_t efi_load_image_from_path(bool boot_policy, > { > efi_handle_t device; > efi_status_t ret; > - struct efi_device_path *dp; > + struct efi_device_path *dp, *rem; > struct efi_load_file_protocol *load_file_protocol = NULL; > efi_uintn_t buffer_size; > uint64_t addr, pages; > @@ -1951,18 +1951,18 @@ efi_status_t efi_load_image_from_path(bool boot_policy, > *size = 0; > > dp = file_path; > - ret = EFI_CALL(efi_locate_device_path( > - &efi_simple_file_system_protocol_guid, &dp, &device)); > + device = efi_dp_find_obj(dp, NULL, &rem); > + ret = efi_search_protocol(device, &efi_simple_file_system_protocol_guid, > + NULL); I think that you intended to use your *new* efi_dp_find_obj() in patch#3 here. -Takahiro Akashi > if (ret == EFI_SUCCESS) > return efi_load_image_from_file(file_path, buffer, size); > > - ret = EFI_CALL(efi_locate_device_path( > - &efi_guid_load_file_protocol, &dp, &device)); > + ret = efi_search_protocol(device, &efi_guid_load_file_protocol, NULL); > if (ret == EFI_SUCCESS) { > guid = &efi_guid_load_file_protocol; > } else if (!boot_policy) { > guid = &efi_guid_load_file2_protocol; > - ret = EFI_CALL(efi_locate_device_path(guid, &dp, &device)); > + ret = efi_search_protocol(device, guid, NULL); > } > if (ret != EFI_SUCCESS) > return EFI_NOT_FOUND; > @@ -1971,9 +1971,9 @@ efi_status_t efi_load_image_from_path(bool boot_policy, > if (ret != EFI_SUCCESS) > return EFI_NOT_FOUND; > buffer_size = 0; > - ret = load_file_protocol->load_file(load_file_protocol, dp, > - boot_policy, &buffer_size, > - NULL); > + ret = EFI_CALL(load_file_protocol->load_file( > + load_file_protocol, rem, boot_policy, > + &buffer_size, NULL)); > if (ret != EFI_BUFFER_TOO_SMALL) > goto out; > pages = efi_size_in_pages(buffer_size); > @@ -1984,7 +1984,7 @@ efi_status_t efi_load_image_from_path(bool boot_policy, > goto out; > } > ret = EFI_CALL(load_file_protocol->load_file( > - load_file_protocol, dp, boot_policy, > + load_file_protocol, rem, boot_policy, > &buffer_size, (void *)(uintptr_t)addr)); > if (ret != EFI_SUCCESS) > efi_free_pages(addr, pages); > -- > 2.34.1 >