From patchwork Fri Oct 1 05:02:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 515009 Delivered-To: patch@linaro.org Received: by 2002:a02:606e:0:0:0:0:0 with SMTP id d46csp454060jaf; Thu, 30 Sep 2021 22:08:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfPtgw7F+A+5zwr8xFqtQc0boKzhRks+tHCf8mXUoX0w791/PEBEO+oHKCsPauKIxBiOSf X-Received: by 2002:a05:6402:411:: with SMTP id q17mr12019945edv.35.1633064937905; Thu, 30 Sep 2021 22:08:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633064937; cv=none; d=google.com; s=arc-20160816; b=JiPYwxBfEGEmY+zNnJN4DFrn1sTLYOPS8ljW1+lMosJjRTnFB+VL0/drRTgkdRdZjM Pv59Ry8BPqf5rWNEGvqDLTtPki9TqUBnibcQOwJ6COulmqXgW2SOYP/gifdt6oGOH+mN IapUy6Z8o60jUhOKMNa6WMfSgWbvhIg5IzSFtLFPY5hrKBx3KyLdSYOaWdmcz4B9d01u yqDrIPuC4MGOydm+mgTsE8fgqbvr9nA1QLp+zaW+qFNlM7O4bQIpQcxko8K284EBi0mh FsInjJAa393OIZHpA19lkr6jz4ybaVV7mfYd4TlA7vbSKpxmsS5Grao6w8JPITyocKwO hCEA== 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=ZLFIjZRtSzQK4PJWHsLX/He8P+gXs0yhNJ5JKRFuEJhGs+ToTViLfKWGKDCj5osYXi oU8MaJ4mPbUMUgEes+R/Tvlb3bp6l2BvfJqMrv1esBruv0Hd5EBoF1rg5Gv16vnL75S0 5QoOpBOCJW/Q/vyn9iYYtLbB8nCUuHWN5XZzJj3xQVSKmR3UvNlhgrzUJVpez+yplQ/x D5Twe7XQtz1msVxrI9vqtllSoTTjqAiGHiKHc9ygL6RVG3neahVl1hY4XSTe+VxMArcO N2mP/LLPJ/5t461ySaRn64w2GJDWhsuqMRA1xo7Y88gqL6/j/RJiKF0s/VkX9Ye526kr Ln/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v6g6RpEp; 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 m12si6130938ejn.240.2021.09.30.22.08.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:08:57 -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=v6g6RpEp; 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 E81AF8347F; Fri, 1 Oct 2021 07:05:26 +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="v6g6RpEp"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 84E3F83474; Fri, 1 Oct 2021 07:04:48 +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-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) (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 2A4F383431 for ; Fri, 1 Oct 2021 07:04:41 +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-pf1-x432.google.com with SMTP id w14so6924103pfu.2 for ; Thu, 30 Sep 2021 22:04:41 -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=v6g6RpEpnumBxT98wFlMRue66tjBPqmfaPZt2EY9gxMBy5spAlcgG4tYpumHRIFPtn AvAcKJFqsKvgY1mLVGgqANMEf3OeEpol5dhJh0PSUJaosfbMxmnVi8NxQhFMd+s6Ynq0 IXdT+JDZGqY/DLe6jiUXLz2QUUUqtPCigdt/lJlJIXabQ9rrlOabybz+ryGanLgqKhkH SXdm9UUa6NRzJZ2+qiZUXFy4GoMweSIFCp6xcAfcpPCTg7VymS1eRe0CsxIzwjNZ8Fl8 TAPyDQ+IyKy6/9rPtSKA82NgK80a8lbaZ6ZOgE6BeZXhmRDDMmfYSmfTSoGDIIwcT8a9 mgvw== 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=Iq3NtWAntohhvswgZKKTd/bHtW6v3Y8j2mdJxF/ETec8k4GF3jkB5biGVBxXC6Ou4o uQ7UZKQ+WucPL7vi4B1e7z59E/0ViafM76q+kcT1RzLUe9DF1u0Um3piUjnsQ7DFp1j6 HdMWLvmemVjpcs3K0J4PMvTuagYQ2RdXh1lVKC7IuFAGGNqU6MnP2GpLN34WjLGlFRRJ lc28X72ykNf76Zx1xiBjuuI6Gyo7nx4E/uWDe+KgpLlN+3wa9QgKKx0Bpq2ThElU0uOU /uBdY+cNnt2Vxgtd1Nw/eRwVOwR3aGntGo+uRCnNIjHzBWYn17VCWKkv760pF70WP3K4 yeLA== X-Gm-Message-State: AOAM53217iY9g02qb5b+LoyiqtybRY7F0iO4c/xiGm+p5AKFz7HgSAYv ddnVBvC0owF7daSNmaqtoZyrOw== X-Received: by 2002:aa7:8bd4:0:b0:44b:1f60:497 with SMTP id s20-20020aa78bd4000000b0044b1f600497mr8256460pfd.78.1633064679368; Thu, 30 Sep 2021 22:04:39 -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.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 22:04:38 -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 16/22] efi_loader: cleanup after efi_disk-dm integration Date: Fri, 1 Oct 2021 14:02:16 +0900 Message-Id: <20211001050228.55183-33-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 Reviewed-by: Simon Glass 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)