diff mbox series

[resent,RFC,15/22] dm: blk: call efi's device-probe hook

Message ID 20211004034430.41355-16-takahiro.akashi@linaro.org
State New
Headers show
Series efi_loader: more tightly integrate UEFI disks to device model | expand

Commit Message

AKASHI Takahiro Oct. 4, 2021, 3:44 a.m. UTC
Adding this callback function, efi_disk_create() in block devices's
post_probe hook will allows for automatically creating efi_disk objects
per block device.

This will end up not only eliminating efi_disk_register() called in UEFI
initialization, but also enabling detections of new block devices even
after the initialization.

Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org>

---
 drivers/block/blk-uclass.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

-- 
2.33.0
diff mbox series

Patch

diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 8fbec8779e1e..ce45cf0a8768 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -9,6 +9,7 @@ 
 #include <common.h>
 #include <blk.h>
 #include <dm.h>
+#include <efi_loader.h>
 #include <log.h>
 #include <malloc.h>
 #include <part.h>
@@ -827,6 +828,11 @@  int blk_create_partitions(struct udevice *parent)
 
 static int blk_post_probe(struct udevice *dev)
 {
+	if (CONFIG_IS_ENABLED(EFI_LOADER)) {
+		if (efi_disk_create(dev))
+			debug("*** efi_post_probe_device failed\n");
+	}
+
 	if (IS_ENABLED(CONFIG_PARTITIONS) &&
 	    IS_ENABLED(CONFIG_HAVE_BLOCK_DEVICE)) {
 		struct blk_desc *desc = dev_get_uclass_plat(dev);
@@ -843,6 +849,10 @@  static int blk_post_probe(struct udevice *dev)
 
 static int blk_part_post_probe(struct udevice *dev)
 {
+	if (CONFIG_IS_ENABLED(EFI_LOADER)) {
+		if (efi_disk_create(dev))
+			debug("*** efi_post_probe_device failed\n");
+	}
 	/*
 	 * TODO:
 	 * If we call blk_creat_partitions() here, it would allow for