From patchwork Fri Jul 14 05:44:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahisa Kojima X-Patchwork-Id: 702714 Delivered-To: patch@linaro.org Received: by 2002:adf:db4e:0:b0:314:25da:8dc4 with SMTP id f14csp906461wrj; Thu, 13 Jul 2023 22:47:16 -0700 (PDT) X-Google-Smtp-Source: APBJJlE6xaPghOgmYjJ3qdBvGLH2a42pvfGowtgSX69RZMmfCMJ16+v9lnbeyFbiFvWPt5/8qZHL X-Received: by 2002:a2e:7a01:0:b0:2b7:a64:91bd with SMTP id v1-20020a2e7a01000000b002b70a6491bdmr3356365ljc.35.1689313636163; Thu, 13 Jul 2023 22:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689313636; cv=none; d=google.com; s=arc-20160816; b=Viwaw98mLaB0vm9TsDo2d4cL6HuDch0vDhmfaKh/jwLIMpa5HOX/zub0w4m1z0uSC9 44ZwBw+h0qcLWQgEWedwIetNCARwC8cs+OJb+TNUc3Q+CyJtmDMkf/iB8bRCgSUh0VoQ 3R5U1jEYjxNLbETJq9oB8JJONDm1/d/X3tWGAc2rdLhRifyb3bxxTKwzKxqgU3D4oyBP YXFOmvG0yKR0+w+noAy0RLKmpnleait3GhmGTP8Zf0Fsqrnu5LdKR+d2nCIzIgfAdP/F owPTnptAcbJob1mE12WmbGvOKizQMxldBAcIfLy6WZ4diC4Cslh3fTbg+wGLgX/QMXh3 rHYg== 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:message-id:date:subject:cc:to:from:dkim-signature; bh=oaD+AZ/cg2WY5ceM3kbM2jerFJlRULmCnv7Gcel163I=; fh=xTN8zo5rzpABERcWHVpYCdCrcH4F7J76p6VSzZMpffc=; b=o6f3sc2veQgSUGbzcYkpl2K8SsOfw/+nY6KfsHXIPAplKDryDZMTIhZ/s+DMh3WLBQ LSiV1uJjthJYtXQca/3lEVuU0yI55xEGu8xZ8msT5hvLrZuRGkdkqFgiZeSYUWS/7DOE kQ+4znyZRtniDn2Kj9Zu7khPXdGUMHHyNaSayh3TrOycjen54gqFBFOvabf0gPYCLT83 C5YVhaizgRMfqi8elBjJvJWl0YQq5a/lhHobYlFqF9nvzT6DXuXy2VCtn9+FlQJsYPLf EjQ1OTfLNooZ0JdPVkp1v6OJsJhrWad17Bfg6Q3v6HWWANTLeuGsOnhOMV8Gk/7U9Qli q0sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mj6WgE6K; 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 j10-20020aa7c40a000000b0051e5c4351absi8178395edq.82.2023.07.13.22.47.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 22:47:16 -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=Mj6WgE6K; 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 9E8EF86D14; 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=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="Mj6WgE6K"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id A794886D14; Fri, 14 Jul 2023 07:47: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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,LOTS_OF_MONEY,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) (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 08B7286D0E for ; Fri, 14 Jul 2023 07:47:10 +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-oo1-xc2d.google.com with SMTP id 006d021491bc7-565f2567422so1040296eaf.2 for ; Thu, 13 Jul 2023 22:47:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689313628; x=1691905628; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=oaD+AZ/cg2WY5ceM3kbM2jerFJlRULmCnv7Gcel163I=; b=Mj6WgE6K6RLoEMSChS/7B3IEJ1dXcvhGL0TaMtBLvpukbxfYOQn7n1vsHGe/AoaDIe 5yT37St+fnMNcaIABC2uvqwxEYcOgaRTg3g22TM2O/79xvnebCjxaLCYwSQHFnfQmu63 MsZIbgBLsIauDlgA5cayaubJpK318FbboT6rj4SJ2xZB0OvD4CMlXgCS8VNiYbuFl3qb CLusKMwobRuIIhdL9/NZgEMUIh8tTAQ0V6Pd3Sl6WzioL/GD7Z1tu4k2jzdAvh/VyFO9 qZ5geUGx7pJQksR+QMqajJ7NtHi8BQST6mu5nJjTCWQW0wrYfL7i6eM33WzfwIR5MB6W 90zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689313628; x=1691905628; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=oaD+AZ/cg2WY5ceM3kbM2jerFJlRULmCnv7Gcel163I=; b=NazXhEjfVsdepz83QSnMK3t9Yyedyk9RF/9WadNePij6V83svc2Rzh/cRFX+VzC4mk 4MGa74G5IQzoiDBVD6gdk5pVyU21UR+TmZnKGa5+GeaHAdGFPGLVM5AyUqAi+d/VWu85 B2c7tC7Y0Iqf0UKJydRETsj9rmR/Qpas6rLrJXnhTXOODhUFHLrMJ5VKGYWwHrcGqjf8 bIrgyOsjAvx2MND55saaXrQY0yK+7e8vDTico6B71R6slstZZfkSIQ6irkmAzUMw2z2o 5x8+QsewcAk7WOO8mRsrptdoSdjgMeb/JKp+D2FwSINUtZAR/yOx7d4+NigGEQf8jq3v gMtA== X-Gm-Message-State: ABy/qLbUZqGZJFL/kTAt4Ej84lR21idfVu8TM0CrpqkhQxO3J0rvfRq8 y0eTp+z7eXFgNY1Jdbt/b6JDPa8cMOjnV9b6LG4= X-Received: by 2002:a05:6358:27a6:b0:134:211:e2f5 with SMTP id l38-20020a05635827a600b001340211e2f5mr4052094rwb.29.1689313628078; Thu, 13 Jul 2023 22:47:08 -0700 (PDT) Received: from localhost ([164.70.16.189]) by smtp.gmail.com with ESMTPSA id 4-20020a17090a1a4400b00263f8915aa3sm442559pjl.31.2023.07.13.22.47.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jul 2023 22:47:07 -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 0/6] introduce EFI_RAM_DISK_PROTOCOL Date: Fri, 14 Jul 2023 14:44:00 +0900 Message-Id: <20230714054406.761508-1-masahisa.kojima@linaro.org> X-Mailer: git-send-email 2.34.1 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 series introduces the EFI_RAM_DISK_PROTOCOL implementation. The major purpose of this series is a preparation for EFI HTTP(S) boot. Now U-Boot can download the distro installer ISO image via wget or tftpboot commands, but U-Boot can not mount the downloaded ISO image. By calling EFI_RAM_DISK_PROTOCOL->register API, user can mount the ISO image and boot the distro installer. Note that the installation process may not proceed after the distro installer calls ExitBootServices() since there is no hand-off process for the block device of memory mapped ISO image. The EFI_RAM_DISK_PROTOCOL was tested with the debian network installer[1] on qemu_arm64 platform. The example procedure is as follows. => tftpboot 41000000 mini.iso => efidebug disk mount 41000000 $filesize or => ramdisk mount 41000000 $filesize ramdisk command works without CONFIG_EFI_LOADER enabled. After these commands, ISO image is mounted like: => efidebug dh 000000007eec63f0 (ramdisk_blk#0) /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0) Block IO 000000007eec6560 (ramdisk_blk#0:1) /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0)/HD(1,0x01,0,0x0,0x33800) Block IO 000000007eec66d0 (ramdisk_blk#0:2) /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0)/HD(2,0x01,0,0x33800,0x10000) Block IO System Partition Simple File System => dm tree -s ramdisk 0 [ + ] ramdisk |-- ramdisk0 blk 0 [ + ] ramdisk_blk | `-- ramdisk_blk#0 partition 0 [ + ] blk_partition | |-- ramdisk_blk#0:1 partition 1 [ + ] blk_partition | `-- ramdisk_blk#0:2 Debian can be successfully installed with this ramdisk on QEMU. The created ramdisk can be accessed by the existing commands such as 'fatls': => fatls ramdisk 0:2 [TODO] - add ramdisk command documentation - add ramdisk command dm test [1] https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/mini.iso [Changelog] v1 -> v2 - implement ramdisk uclass and driver, then EFI_RAM_DISK_PROTOCOL is implemented based on the ramdisk uclass Masahisa Kojima (6): efi_loader: add RAM disk device path ramdisk: add ramdisk uclass and driver cmd: ramdisk: add ramdisk control command efi_loader: add EFI_RAM_DISK_PROTOCOL implementation cmd: efidebug: add RAM disk mount command efi_selftest: add EFI_RAM_DISK_PROTOCOL selftest cmd/Kconfig | 7 + cmd/Makefile | 1 + cmd/efidebug.c | 118 ++++++ cmd/ramdisk.c | 92 ++++ disk/part.c | 3 + drivers/block/Kconfig | 7 +- drivers/block/Makefile | 2 + drivers/block/blk-uclass.c | 1 + drivers/block/blk_ramdisk.c | 187 +++++++++ drivers/block/ramdisk-uclass.c | 14 + include/dm/uclass-id.h | 1 + include/efi_api.h | 32 ++ include/efi_loader.h | 4 + include/ramdisk.h | 32 ++ lib/efi_loader/Kconfig | 7 + lib/efi_loader/Makefile | 1 + lib/efi_loader/efi_device_path.c | 25 ++ lib/efi_loader/efi_device_path_to_text.c | 14 + lib/efi_loader/efi_ram_disk.c | 142 +++++++ lib/efi_loader/efi_setup.c | 6 + lib/efi_selftest/Makefile | 1 + lib/efi_selftest/efi_selftest_ram_disk.c | 511 +++++++++++++++++++++++ lib/uuid.c | 4 + 23 files changed, 1211 insertions(+), 1 deletion(-) create mode 100644 cmd/ramdisk.c create mode 100644 drivers/block/blk_ramdisk.c create mode 100644 drivers/block/ramdisk-uclass.c create mode 100644 include/ramdisk.h create mode 100644 lib/efi_loader/efi_ram_disk.c create mode 100644 lib/efi_selftest/efi_selftest_ram_disk.c base-commit: e2e2aea5733f0d23cd9593bbefe5c803c552dcb9