From patchwork Mon Oct 4 03:44:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515144 Delivered-To: patch@linaro.org Received: by 2002:ac0:890a:0:0:0:0:0 with SMTP id 10csp1062632imy; Sun, 3 Oct 2021 20:48:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJLtkf6TbwLDp+BbYO6q/jxllHrg8O8C2n0XWs82Y0EutQw1p5Zp7B3l6RTVNftfthpt2k X-Received: by 2002:a17:906:66d5:: with SMTP id k21mr13993726ejp.487.1633319286565; Sun, 03 Oct 2021 20:48:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633319286; cv=none; d=google.com; s=arc-20160816; b=ibtOda6Z9LJjnOav7ApS3VqZJCF8CVw1KfIzgaq17a+wzOwRB4BAdgytR7Yeo5abVs 3jv3XVMJ2sQdsjl7gNOnKZALU6w1hjHlOQW2NgFn4e9pQYig4C8QkmO90Dh4oWJxljTZ rTHuwEsXl+XVhAl76NX6/yk0QP0vcawjG9rNdcYzfG2k5RH/+bG9AguBi8r0gb8q9BFn AO86UYBPVg3zxAGR7eMG9QqdvsE6tPXCL6y8bY0MC5GEgmF3NkE7NvZc2JTnNszumL0D 1s6bnWVpMXCc7Tih59lJ3oONG/d5e8B3tMM9QJ2QosQi7rDzFuMMlniOcpwF9ivv/nzz flhA== 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=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=G/QiYlZyFcJO8D2Hp6TGCtKi3cHz3fzZEIjGPqKhpdRSPBleH0ZkN/0ZOf7XUa6i6n lixLHAh5P0eQ1GcRosKTgOh/dJsiQjNWv7hwKGgYZHyLh4I+swA6MUIwXYS6oMRh9h+Z KHuDdthb9lXSYLUCIX+vq+QvzRriKif24uQQwhOK2hNo5BzIPLGwb2EZ0R2moHq7LcjE RymaxQpF+Uu1h/HAznndcy8TY9S5osKqaPevaZzNoHoeUIPXmlXiU4UGcjxQqiF/+qb5 5n+goTEikp4H9uz+4wELTg/VB0GmBW4UHkkF7ay/UJWBW5op1pKHgph8r3zskiPAHmNc j9nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hSOz2901; 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 g14si15109763ejj.426.2021.10.03.20.48.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:48:06 -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=hSOz2901; 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 0FB9483571; Mon, 4 Oct 2021 05:46:46 +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="hSOz2901"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3E8E48358D; Mon, 4 Oct 2021 05:46:26 +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 autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) (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 C073C83562 for ; Mon, 4 Oct 2021 05:46:17 +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=takahiro.akashi@linaro.org Received: by mail-pg1-x52e.google.com with SMTP id 133so15275231pgb.1 for ; Sun, 03 Oct 2021 20:46:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=hSOz2901nUL91GhPLoTunlCOY/AEyYprqrpTO6hCAXlHUNpeabdl5aZS03Vu71qSla GAnMUcusZxvpVh4opIJYRJ2liakf4iydZejvIiS4YAq/TqFGEklvRl98EdKWg5Zgdtb0 ZQzJjOvTQq8z392EU7iZRTC9mlQyP9BDoetN26Y0+Hc/MOA87/0IWiuLjdf5GtelhY5j MkzoUh1Sa6kqedDAYMRQk3t9pdZ/3m+TQK6oDqj4NvKoVdZObiFpf73RnrB85ZGN2ZCW WLjAobTbJdpdyJTq9i/ZATfs5i/6jzE6NM92+wRZ+TskeMH2zkm6UB4AWN3Fk6r+S2Eq Vesg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jpV0cWL/BL9yctRVKQuoN+QP14asKqFyYi2n1JjcZxA=; b=A55dWk06qTGB3II+jTHz3rx1hGASlwLH5crGhkLVP8UodD9R3NOijIgDZ+Pt4HOh/N VFbSM3AZe/e/+n/vnXG1mBfAP2dbd82qw+iRBRGUZgmwaq3zvBTXJy73w6MnHn8Z10ES TV0Bo7NlszoHZ2v1k/5TQXkslayWFrh3Di/CYRbOVUzr/15Vj9Z9KO+Ww8qWTsFZq9pF w8OoLUlq9VadnUHBQ3RJ6X/eoHtu0sDMVtN8Mqyyk91+rLwc4zbuaG591XzZvpzL7baI VcTGVSOrnJGyP68A2V9lz0120q7IJ58JAjwhONbQY4j0wjMtXkWc03jH6qLU4XxmGhNI vUPw== X-Gm-Message-State: AOAM530WuZ9S6IPZ5UfL1PGLppaNxxI2Z47hKUpFo9ogRs5E9eiNsd37 p9ESAM8MN9k3K1Jn3nn3DKiKP9h4j+4l6g== X-Received: by 2002:a65:6643:: with SMTP id z3mr9008717pgv.16.1633319176087; Sun, 03 Oct 2021 20:46:16 -0700 (PDT) Received: from localhost.localdomain (61-205-96-147m5.grp4.mineo.jp. [61.205.96.147]) by smtp.gmail.com with ESMTPSA id a11sm11863515pgj.75.2021.10.03.20.46.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 20:46:15 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: u-boot@lists.denx.de, AKASHI Takahiro Subject: [resent RFC 16/22] efi_loader: cleanup after efi_disk-dm integration Date: Mon, 4 Oct 2021 12:44:24 +0900 Message-Id: <20211004034430.41355-17-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004034430.41355-1-takahiro.akashi@linaro.org> References: <20211004034430.41355-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean efi_disk_register() will be no longer needed now that all efi_disks are set to be created with device model thanks to efi_disk-dm integration. Signed-off-by: AKASHI Takahiro --- include/efi_loader.h | 2 - lib/efi_loader/efi_disk.c | 102 ------------------------------------- lib/efi_loader/efi_setup.c | 5 -- 3 files changed, 109 deletions(-) -- 2.33.0 diff --git a/include/efi_loader.h b/include/efi_loader.h index 751fde7fb153..cfbe1fe659ef 100644 --- a/include/efi_loader.h +++ b/include/efi_loader.h @@ -519,8 +519,6 @@ void efi_carve_out_dt_rsv(void *fdt); efi_status_t efi_console_register(void); /* Called when a block devices has been probed */ int efi_disk_create(struct udevice *dev); -/* Called by bootefi to make all disk storage accessible as EFI objects */ -efi_status_t efi_disk_register(void); /* Called by efi_init_obj_list() to install EFI_RNG_PROTOCOL */ efi_status_t efi_rng_register(void); /* Called by efi_init_obj_list() to install EFI_TCG2_PROTOCOL */ diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c index 3fae40e034fb..74ef923d1d67 100644 --- a/lib/efi_loader/efi_disk.c +++ b/lib/efi_loader/efi_disk.c @@ -485,56 +485,6 @@ error: return ret; } -#ifndef CONFIG_BLK -/** - * efi_disk_create_partitions() - create handles and protocols for partitions - * - * Create handles and protocols for the partitions of a block device. - * - * @parent: handle of the parent disk - * @desc: block device - * @if_typename: interface type - * @diskid: device number - * @pdevname: device name - * Return: number of partitions created - */ -int efi_disk_create_partitions(efi_handle_t parent, struct blk_desc *desc, - const char *if_typename, int diskid, - const char *pdevname) -{ - int disks = 0; - char devname[32] = { 0 }; /* dp->str is u16[32] long */ - int part; - struct efi_device_path *dp = NULL; - efi_status_t ret; - struct efi_handler *handler; - - /* Get the device path of the parent */ - ret = efi_search_protocol(parent, &efi_guid_device_path, &handler); - if (ret == EFI_SUCCESS) - dp = handler->protocol_interface; - - /* Add devices for each partition */ - for (part = 1; part <= MAX_SEARCH_PARTITIONS; part++) { - struct disk_partition info; - - if (part_get_info(desc, part, &info)) - continue; - snprintf(devname, sizeof(devname), "%s:%x", pdevname, - part); - ret = efi_disk_add_dev(parent, dp, if_typename, desc, diskid, - &info, part, NULL); - if (ret != EFI_SUCCESS) { - log_err("Adding partition %s failed\n", pdevname); - continue; - } - disks++; - } - - return disks; -} -#endif /* CONFIG_BLK */ - /* * Create a handle for a whole raw disk * @@ -624,58 +574,6 @@ int efi_disk_create(struct udevice *dev) return -1; } -/** - * efi_disk_register() - register block devices - * - * U-Boot doesn't have a list of all online disk devices. So when running our - * EFI payload, we scan through all of the potentially available ones and - * store them in our object pool. - * - * This function is called in efi_init_obj_list(). - * - * TODO(sjg@chromium.org): Actually with CONFIG_BLK, U-Boot does have this. - * Consider converting the code to look up devices as needed. The EFI device - * could be a child of the UCLASS_BLK block device, perhaps. - * - * Return: status code - */ -efi_status_t efi_disk_register(void) -{ - struct efi_disk_obj *disk; - int disks = 0; - efi_status_t ret; - struct udevice *dev; - - for (uclass_first_device_check(UCLASS_BLK, &dev); dev; - uclass_next_device_check(&dev)) { - struct blk_desc *desc = dev_get_uclass_plat(dev); - const char *if_typename = blk_get_if_type_name(desc->if_type); - - /* Add block device for the full device */ - log_info("Scanning disk %s...\n", dev->name); - ret = efi_disk_add_dev(NULL, NULL, if_typename, - desc, desc->devnum, NULL, 0, &disk); - if (ret == EFI_NOT_READY) { - log_notice("Disk %s not ready\n", dev->name); - continue; - } - if (ret) { - log_err("ERROR: failure to add disk device %s, r = %lu\n", - dev->name, ret & ~EFI_ERROR_MASK); - return ret; - } - disks++; - - /* Partitions show up as block devices in EFI */ - disks += efi_disk_create_partitions( - &disk->header, desc, if_typename, - desc->devnum, dev->name); - } - log_info("Found %d disks\n", disks); - - return EFI_SUCCESS; -} - /** * efi_disk_is_system_part() - check if handle refers to an EFI system partition * diff --git a/lib/efi_loader/efi_setup.c b/lib/efi_loader/efi_setup.c index a2338d74afac..618526eaa7c6 100644 --- a/lib/efi_loader/efi_setup.c +++ b/lib/efi_loader/efi_setup.c @@ -230,11 +230,6 @@ efi_status_t efi_init_obj_list(void) if (ret != EFI_SUCCESS) goto out; -#ifdef CONFIG_PARTITIONS - ret = efi_disk_register(); - if (ret != EFI_SUCCESS) - goto out; -#endif if (IS_ENABLED(CONFIG_EFI_RNG_PROTOCOL)) { ret = efi_rng_register(); if (ret != EFI_SUCCESS)