From patchwork Fri Jul 7 04:00:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 700013 Delivered-To: patch@linaro.org Received: by 2002:adf:fcc5:0:0:0:0:0 with SMTP id f5csp3663394wrs; Thu, 6 Jul 2023 21:01:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlHGKmgYay8/gKfyvcyC1nZnwWlIG8cCIF2ylAGSXQSaJo0Y48/8Fkyj1PlY2gF6/6oapz4E X-Received: by 2002:a6b:e009:0:b0:786:2a1e:4e1f with SMTP id z9-20020a6be009000000b007862a1e4e1fmr5315935iog.10.1688702506720; Thu, 06 Jul 2023 21:01:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688702506; cv=none; d=google.com; s=arc-20160816; b=O8xgS0WdItNS+TLHNfHLrFdsUrxr6Vi0rfM1zTVEaL/RwvJ97cMd2EMxEpCMAyG4S+ pfueE7K3qwhPlZ9gjxCKHP7ezZEUZB1wZNtRDbYKi3DYeUOcxkY3jMrHaO9jgiSU5yuB 0IabDkCMfXW5zmqWqc2tnDH1JPCKx5muVgseFv/rxZ4SaHUHDU49Hkd/Ean4eYNKsUel hrNkDyy4LloNM5haQmszqFGlc9ywYpsm+WH2w1GtS0bgBMWqkPQ1GxED8RvN4SZOIdHV JkxVzplM9qdwCdh/P+g8SKzNIOmaW7LJgCZA6937R7gYseAV13LiGg3sOSK6oCQbZ42u z14Q== 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:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TaxBuyANh3GRzNUNGq5DXNK9Ok7IJeiYHBAOstodDu4=; fh=UqK/4Wc1IgH8GVyLylIZPdO/qWI3a/IzA+fwLs4tfXk=; b=tcPiiENwsCBKw/zB+SP35cPSXft9mKqMl2Cdx0pB2RiayxeRR/Nj3zFvuN5lXvzt8L EIcjLUBaPyDcV91zs11qXqv3OYHdyI5FPhUP5VpXikFYqfzKb8BhO+AF1qmqUPCsf3KZ pV7X8O8L5iOCakqrf2AlMMJyzH5uKVWMaBIMzEjjYlQH16tHpkhSjz3/KR6/aAlIGD44 6iM6X2txvceszhOwmYO1X5vFr2yLlZkAhP2pbtAdZjFUjZhmoM520ERUpzANI02BFBS9 6HMm6ma7f9wNA7ml7O2NGoVZ03H0hytoCZc5Fr+ikJqUZQuqVhKmD0SSapfD9jBoNJ6e n5hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Fc4Slizx; 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 f12-20020a6bdd0c000000b00778356abcecsi1103148ioc.96.2023.07.06.21.01.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 21:01:46 -0700 (PDT) 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=Fc4Slizx; 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 517F1863C2; Fri, 7 Jul 2023 06:01:37 +0200 (CEST) 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="Fc4Slizx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9E27B863C9; Fri, 7 Jul 2023 06:01:35 +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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) (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 2EC9D863C2 for ; Fri, 7 Jul 2023 06:01:33 +0200 (CEST) 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-oa1-x30.google.com with SMTP id 586e51a60fabf-1b0606bee45so1448875fac.3 for ; Thu, 06 Jul 2023 21:01:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688702491; x=1691294491; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TaxBuyANh3GRzNUNGq5DXNK9Ok7IJeiYHBAOstodDu4=; b=Fc4Slizx/WbhPyjCdkkNww8xYkyIN/MjyECR4iGdr9Yfns1ucq4/3W4H6ZMdU3oTgn 9pu3ljLbv6wKn1xfDdHPwLUuIoHT83AAs5NA081eAJuN6IYo449iSFR0ZjhkGLOcSJQS Uq/bG9MxV8I/oHk2hU+teEQsToDer2yveSICY9eyAH0ro7zchAm7wg7u48nDICcgwb8+ 40ngSE0WT7WjHnWrcWaKQ8niBh6+7oINwo4bx4D4JDnag3u9UMYCJFxYv4C+oPCJynqY lVPLKg+RKZN4S6RbxsOW9MNFxY4jBtRhj3saXdtarEBKaP54EHPhgmMgUrdUxZPdF1Cv Bp2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688702491; x=1691294491; h=content-transfer-encoding:mime-version: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=TaxBuyANh3GRzNUNGq5DXNK9Ok7IJeiYHBAOstodDu4=; b=RdLuUvkhQEHMJGc4FcO2XRiflicKrD9QyDZc3oImuQPnDhqBK+SQKvk9tHfQl0Jmkp 39HxOTupvWwJunulwvj2OpXc/8JrUXLh+Xcc5vS3FB33AOFzSYDON3UG8zSMOSm8Kyc5 AsldUSKLmKwuU1ake0xDX2fQpX7MoqV6cn4vSQwn7ay9riFMEOwhlQXj0NUxa153K2nc rEy/hBXyZHuVUa7flENORGTcUYRxudsn5y3Uj0W1XllfxXm+wrc2Ygc7UHDKbjrOtAs3 nNyCt2PhU1nK1bbzRjC7MSmJHMZONz3mjMbZ7qD2JR+jY1HHviwJxjoYpojxCNSHU9j7 JzUg== X-Gm-Message-State: ABy/qLbm89bmHXwiL1SatVggdPxzY4AtAc/toex0Ii7NLnTrm4TsbCN8 ep7n6b6+yIyG8tupMQ8UvB2B8IVXjZBe5USZJiw= X-Received: by 2002:a05:6870:82a0:b0:1b0:3e84:1dc5 with SMTP id q32-20020a05687082a000b001b03e841dc5mr4909234oae.54.1688702491559; Thu, 06 Jul 2023 21:01:31 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 30-20020a17090a1a5e00b0025930e50e28sm569722pjl.41.2023.07.06.21.01.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jul 2023 21:01:31 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , AKASHI Takahiro , Masahisa Kojima Subject: [PATCH 1/4] efi_loader: add RAM disk device path Date: Fri, 7 Jul 2023 13:00:41 +0900 Message-Id: <20230707040045.485790-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230707040045.485790-1-masahisa.kojima@linaro.org> References: <20230707040045.485790-1-masahisa.kojima@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 This is a preparation to add the EFI_RAM_DISK_PROTOCOL. This commit adds the RAM disk device path structure and text conversion to Device Path to Text Protocol. Signed-off-by: Masahisa Kojima --- include/efi_api.h | 19 +++++++++++++++++++ lib/efi_loader/efi_device_path_to_text.c | 14 ++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/include/efi_api.h b/include/efi_api.h index 55a4c989fc..4ee4a1b5e9 100644 --- a/include/efi_api.h +++ b/include/efi_api.h @@ -682,6 +682,7 @@ struct efi_device_path_uri { # define DEVICE_PATH_SUB_TYPE_CDROM_PATH 0x02 # define DEVICE_PATH_SUB_TYPE_VENDOR_PATH 0x03 # define DEVICE_PATH_SUB_TYPE_FILE_PATH 0x04 +# define DEVICE_PATH_SUB_TYPE_RAM_DISK_PATH 0x09 struct efi_device_path_hard_drive_path { struct efi_device_path dp; @@ -705,6 +706,24 @@ struct efi_device_path_file_path { u16 str[]; } __packed; +/* This GUID defines a RAM Disk supporting a raw disk format in volatile memory */ +#define EFI_VIRTUAL_DISK_GUID \ + EFI_GUID(0x77ab535a, 0x45fc, 0x624b, \ + 0x55, 0x60, 0xf7, 0xb2, 0x81, 0xd1, 0xf9, 0x6e) + +/* This GUID defines a RAM Disk supporting an ISO image in volatile memory */ +#define EFI_VIRTUAL_CD_GUID \ + EFI_GUID(0x3d5abd30, 0x4175, 0x87ce, \ + 0x6d, 0x64, 0xd2, 0xad, 0xe5, 0x23, 0xc4, 0xbb) + +struct efi_device_path_ram_disk_path { + struct efi_device_path dp; + u64 starting_address; + u64 ending_address; + efi_guid_t disk_type_guid; + u16 disk_instance; +} __packed; + #define EFI_BLOCK_IO_PROTOCOL_GUID \ EFI_GUID(0x964e5b21, 0x6459, 0x11d2, \ 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b) diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c index 8c76d8be60..4395e79f33 100644 --- a/lib/efi_loader/efi_device_path_to_text.c +++ b/lib/efi_loader/efi_device_path_to_text.c @@ -324,6 +324,20 @@ static char *dp_media(char *s, struct efi_device_path *dp) free(buffer); break; } + case DEVICE_PATH_SUB_TYPE_RAM_DISK_PATH: { + struct efi_device_path_ram_disk_path *rddp = + (struct efi_device_path_ram_disk_path *)dp; + u64 start; + u64 end; + + /* Copy from packed structure to aligned memory */ + memcpy(&start, &rddp->starting_address, sizeof(start)); + memcpy(&end, &rddp->ending_address, sizeof(end)); + + s += sprintf(s, "RamDisk(0x%llx,%llx,%pUl,0x%x)", start, end, + &rddp->disk_type_guid, rddp->disk_instance); + break; + } default: s = dp_unknown(s, dp); break;