From patchwork Fri Jul 14 05:44:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 702715 Delivered-To: patch@linaro.org Received: by 2002:adf:db4e:0:b0:314:25da:8dc4 with SMTP id f14csp906512wrj; Thu, 13 Jul 2023 22:47:26 -0700 (PDT) X-Google-Smtp-Source: APBJJlGYgmfVUWEzv4MHD/8IFSLDcDnHIoTQm9ShRg/G3+uFcIGJIHz+W+05cCY0OK8UBT+ROD/m X-Received: by 2002:a17:906:7681:b0:98e:2334:af12 with SMTP id o1-20020a170906768100b0098e2334af12mr3054454ejm.45.1689313646375; Thu, 13 Jul 2023 22:47:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689313646; cv=none; d=google.com; s=arc-20160816; b=c4B7+MW7IT5xxgJ83ImVJzKzoUeD2BBt7UHlTeNs4pDvend6qO4Hb7WJMpz+9monXt AJb2D3ios5XCcR6iC1P7fszhWn7SBnIQ2d4Efd5t8J0jW37/5/SWDr3KcAg/tMZxT1mx n54AcLjfk2cGeXhTwo94d8Hy8TyWVvG7Q2Sbp7Aebs6tm2egcCYRWDYaJ7jl0moMCngB 47NDEeLwD6jnDUMt4CHql2PYlXg9pRHFTwwsjEX2l94AiS+PTNqFmIA+BxBtpoLOUcsZ 6KHOqx5VEhZEybvwNO06Smr0aYs2yR3KzDIWZPZrAlUadk4gvDyKSIIAt8n8qkHiavqV N7Aw== 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=fJTbWm4mf+sRF2LwUIwwgOkSYQIrEIiiGr4ORL1uNA0=; fh=xTN8zo5rzpABERcWHVpYCdCrcH4F7J76p6VSzZMpffc=; b=E7kF/eCVdjDg04zwvRiA1uSv0pkKVwtfbFjXQTGqgBBJW2OzR8U5Nav1MzVrJs5EHu 8aGatOGMr8DxNn2dZzgGCv5ldo2+aCXkdbWGp/P2WxDktVyLjll02AoEc7CVV0p8m0Bu zNav/PMN3zETxshafSEn2fiQCj3XIoCoGmo+ZoxZpyOmf9f0BEF84JvIriA0ZppLd9Np eGl6J0PpA2tjyd3e8YsXCNWn+Lt+5hHuK/71QVLi4RRRDk5nkpU0lCF6USrtckQ2kiyl zpiKH3W9IA+S0GHlT75AW4WEoyaR/RkAZ4uXtkYr0ABdjxABHFtl/+TtzojBD5eafqWL AWvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UubrC6Cu; 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=pass (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 j8-20020a170906254800b00991cb7517bbsi8094543ejb.947.2023.07.13.22.47.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 22:47:26 -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; dkim=pass header.i=@linaro.org header.s=google header.b=UubrC6Cu; 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=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 137C286D1E; Fri, 14 Jul 2023 07:47:18 +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="UubrC6Cu"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 21CDA86D22; Fri, 14 Jul 2023 07:47:17 +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-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) (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 987B486D13 for ; Fri, 14 Jul 2023 07:47:14 +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-oi1-x236.google.com with SMTP id 5614622812f47-3a43cbb432aso432105b6e.3 for ; Thu, 13 Jul 2023 22:47:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689313633; x=1691905633; 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=fJTbWm4mf+sRF2LwUIwwgOkSYQIrEIiiGr4ORL1uNA0=; b=UubrC6Cu6ZXUeIDD0M0MeB9eHPI4/lxcpeN3sAjsJOt8pyqiP2QG5X2Gb6LITWJhbE 7TcKvxk3jZPnwY97bUeZ3XXQ6CQkyfHHnJw0wd+pfxcXZyCLkZIUdkNML/HNtKzqOKXz Ed6h3Hzm1TrUv213PRUuEy6YVLmNIDOERRYbXMDxycy4zhyDzVopRXqFPsj1enM7Fg1R WItexOL8ngghjciNt+MTzUjVOt3VMelvEFPZsAH4XnYmir+XXnufFWvclg2/SX8ZKgz+ /10ZP5ztad2btjS31SVyra+YNY3FpZKmRf3TTy4Dijyor9hQzI/NvtumhHgNPQaabclt j7dA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689313633; x=1691905633; 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=fJTbWm4mf+sRF2LwUIwwgOkSYQIrEIiiGr4ORL1uNA0=; b=KY87YVnM0bZ5qQpGP/+G0zKouG6AeCW6H6bP/Eab+BY/G1bFr8TLPB2fvOgpXHRAdk Ca0rLtqr9rT+QluD1PWhBxse8OQEf9FVYBsfOW+J6ltQMBt3Sls16ZEXQfFH++yHY6nu 3hSIsa4A+tI+uYH003ws072jEPHdrLHvD9yaigOhLRgy33K+S5XbMpfAW2KCU13B0FFS xxWgf9eertTB9FFH7Xra6rtDaePclcklPg6DgGfsDNPFn9ZoahXPbsTimr93+pnvHp1B Cju65H9gXFdqubi1mbPFlmEf3bzHNtCiQnOwhYbajjqXPzCt1T4ydidm1s7yA7be1eOI z7kQ== X-Gm-Message-State: ABy/qLa51UbbP178LHSMApzeLrOeKm0F7gP8Ib3c9Zr30gaaDuM9MWtM azEZpy+I3lI82bb3itx+QNl3+ZzR9ETzq8xfF6k= X-Received: by 2002:a05:6808:11cf:b0:3a3:fa64:b543 with SMTP id p15-20020a05680811cf00b003a3fa64b543mr4065265oiv.12.1689313633074; Thu, 13 Jul 2023 22:47:13 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id g12-20020a63ad0c000000b00553d42a7cb5sm6473061pgf.68.2023.07.13.22.47.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 22:47:12 -0700 (PDT) From: Masahisa Kojima To: u-boot@lists.denx.de Cc: Heinrich Schuchardt , Ilias Apalodimas , Simon Glass , Takahiro Akashi , Masahisa Kojima Subject: [PATCH v2 1/6] efi_loader: add RAM disk device path Date: Fri, 14 Jul 2023 14:44:01 +0900 Message-Id: <20230714054406.761508-2-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230714054406.761508-1-masahisa.kojima@linaro.org> References: <20230714054406.761508-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 --- No update since v1 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;