From patchwork Fri Oct 1 05:02:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515007 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp453872jaf; Thu, 30 Sep 2021 22:08:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz/0/3XJy4a30OUUXLnXkOrGL0sIi47/VXEHv3uPST++w5qvlp/wYvewV9niXiZEic7lZ5H X-Received: by 2002:a50:e14c:: with SMTP id i12mr11909759edl.125.1633064917991; Thu, 30 Sep 2021 22:08:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064917; cv=none; d=google.com; s=arc-20160816; b=fLIqGiFNjxyQRUf8kph9JqUcwyAwOBL7ndah+f3ARQn1C/M1X5/JWfFeHbnmife6UL USbkSzCW/igF4f9axlu8U1oizRc+/gSMiOqKUNw0rsmcVM/ndtl/eRVJxCBspLHvi4Vl dBJIT/eHBuRwAJiYyPxr4cJjHVN4j31018gOnMPfX83NNg6d2Z/Ig1hVri3iJbYIKDDb 90Oku2c9NLAeHZRkhKNZjHcQvUieQ4RcMK6mwaMTQx3+k/y3Kw7K6QRTmA2iQPOOYn2B lEx1dSxgweWB33qMSCOzHJO1i+X/VgwrbSUGviTIjyyn3uOxeeWhxwSgZlvDIweomji9 7hSw== 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=w5x1iSqKhHPTg/6GMgNIpFdYaRWhIuiTpuqnRFxU1hH5FevweclQrtJ3HYUP6BOimw RxBt8dycUl796AKVxGM6X7J6KGZGSNEmO+9HIvz867437OQUYSMk7Zxqkhx6fwey96ew TOEY1SD12dTE4HtW2542jtJ4EAC5M6KGWugGU63nq3mM1R+erlv31yFt2q9krsdfI5qK 7Lc44LjpufbUrMULR5L5m8mP1YMyKMYCR3bbGk/R5b90qf+P5EQiUuRF4S57+eJyGk0E TXWpTbSI+wppE/DLbdGcCI1LdB6HyHfngoAgSEmJE9Gm3NBI6izF2/cqT8KFrN/A57h1 4V7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HYEoXLTv; 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 a14si5634685edr.7.2021.09.30.22.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:08:37 -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=HYEoXLTv; 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 2D1338348D; Fri, 1 Oct 2021 07:05:19 +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="HYEoXLTv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DE67481E1C; Fri, 1 Oct 2021 07:04:43 +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-x533.google.com (mail-pg1-x533.google.com [IPv6:2607:f8b0:4864:20::533]) (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 8A97A83433 for ; Fri, 1 Oct 2021 07:04: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=takahiro.akashi@linaro.org Received: by mail-pg1-x533.google.com with SMTP id h3so8351504pgb.7 for ; Thu, 30 Sep 2021 22:04:33 -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=HYEoXLTvioLpgRj6HCzH8+4DDZcy58Hxd9IlMK7q1HtAa6MRYXaLW3rpQYU5KES1dY KT8JjdN4QUnU45x+PDyqYZh0SmQ6UWsMWVE3fX+AKtfGF6eZeg9S1NMtaVBM9FA9qot3 Vz4JhC5F5soxM6pSQnr7LOFQB3s7vUTnADKDy50tfe6Z5Vk4wzXRQQOoAj08dqXDbEf1 /a1KXuSLS/yXTHA+OOFoSnzezwlGDD3esEw4sEj/Vg3khUJmEXWr+nVety+70wP7ULue G03UqndMkdTINSDgNU9nvV/Fl0h7GzHPstIrG/oue1t2sIMwlKs9DX5lu1/8phWrrFFP ZSBw== 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=k6WOX4t/Ccn0h/IoRFtg0d8+pVWbDNbw+bjx7PLW5vJI+QhGnDKbGCnZ29NdsBZPA1 3IZ+XStR2g2rdxeD+XEzBNW+RC+NCiy2ERjAFUj626F4v/Th3+cdamg8nUJk/Jy5Kce+ 3CMjXCnLVg200bMlTHqsB7D91XGYv69mXTPp78qjp6ncD4v6S9i7PnHx4OkvpWfm9v17 Zrz1ChivZ7c0pr34PSuy3qgya6gINdnVCfMvVG5a9M3Uzt26J3y+YFwnQaKmQHcMbB59 qwFl+e182DJMQ0YqaQRFrw4CvcnROY1xdsMf2qNygjc1HNYFzNzOeHIvl9dzeDVP23U1 En8w== X-Gm-Message-State: AOAM532PgmxtC6wuCuKeadeA+fnFr7FlyGTYxJaqkRb8lnA/yt7NBXcv RQz5vZQTYXMj+1+QXYgd6M6uEA== X-Received: by 2002:a63:4b5b:: with SMTP id k27mr7979054pgl.294.1633064671700; Thu, 30 Sep 2021 22:04:31 -0700 (PDT) Received: from localhost.localdomain (122-100-26-52m5.mineo.jp. [122.100.26.52]) by smtp.gmail.com with ESMTPSA id z8sm4615113pgc.53.2021.09.30.22.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:04:31 -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: [RFC 15/22] efi_loader: cleanup after efi_disk-dm integration Date: Fri, 1 Oct 2021 14:02:14 +0900 Message-Id: <20211001050228.55183-31-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211001050228.55183-1-takahiro.akashi@linaro.org> References: <20211001050228.55183-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)