env: ext4: Add support for NVME
authorFabio Estevam <festevam@gmail.com>
Tue, 12 Aug 2025 17:46:11 +0000 (14:46 -0300)
committerTom Rini <trini@konsulko.com>
Wed, 20 Aug 2025 21:05:31 +0000 (15:05 -0600)
Add support for retrieving the EXT4 environment from an NVME device, the
same way it can be retrieved from MMC, SCSI, or VIRTIO.

To use the EXT4 environment from an NVME device, pass
CONFIG_ENV_EXT4_INTERFACE="nvme" in the defconfig.

Signed-off-by: Fabio Estevam <festevam@gmail.com>
env/ext4.c

index d92c844..c8122b4 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <command.h>
 #include <env.h>
+#include <init.h>
 #include <env_internal.h>
 #include <linux/stddef.h>
 #include <malloc.h>
@@ -30,6 +31,7 @@
 #include <errno.h>
 #include <ext4fs.h>
 #include <mmc.h>
+#include <nvme.h>
 #include <scsi.h>
 #include <virtio.h>
 #include <asm/global_data.h>
@@ -156,6 +158,14 @@ static int env_ext4_load(void)
                virtio_init();
 #endif
 
+#if defined(CONFIG_NVME)
+       if (!strcmp(ifname, "nvme")) {
+               if (IS_ENABLED(CONFIG_PCI))
+                       pci_init();
+
+               nvme_scan_namespace();
+       }
+#endif
        part = blk_get_device_part_str(ifname, dev_and_part,
                                       &dev_desc, &info, 1);
        if (part < 0)