distro_bootcmd: add NVME support
PATCH 1/1 distro_bootcmd: add NVME support
Some boards support NVME drives. We should be able to use them as boot devices.
NVME access requires running 'nvme scan'.
--- include/config_distro_bootcmd.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
include/config_distro_bootcmd.h +27 -0
@@ -178,6 +178,31 @@ BOOT_TARGET_DEVICES_references_SATA_without_CONFIG_SATA#endif +#ifdef CONFIG_NVME +#define BOOTENV_RUN_NVME_INIT "run nvme_init; " +#define BOOTENV_SET_NVME_NEED_INIT "setenv nvme_need_init; " +#define BOOTENV_SHARED_NVME \ + "nvme_init=" \ + "if ${nvme_need_init}; then " \ + "setenv nvme_need_init false; " \ + "nvme scan; " \ + "fi\0" \ + \ + "nvme_boot=" \ + BOOTENV_RUN_NVME_INIT \ + BOOTENV_SHARED_BLKDEV_BODY(nvme) +#define BOOTENV_DEV_NVME BOOTENV_DEV_BLKDEV +#define BOOTENV_DEV_NAME_NVME BOOTENV_DEV_NAME_BLKDEV +#else +#define BOOTENV_RUN_NVME_INIT +#define BOOTENV_SET_NVME_NEED_INIT +#define BOOTENV_SHARED_NVME +#define BOOTENV_DEV_NVME \ + BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME +#define BOOTENV_DEV_NAME_NVME \ + BOOT_TARGET_DEVICES_references_NVME_without_CONFIG_NVME +#endif +#ifdef CONFIG_SCSI #define BOOTENV_RUN_SCSI_INIT "run scsi_init; "#define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
@@ -359,6 +384,7 @@BOOTENV_SHARED_USB \ BOOTENV_SHARED_SATA \BOOTENV_SHARED_SCSI \ + BOOTENV_SHARED_NVME \BOOTENV_SHARED_IDE \ BOOTENV_SHARED_UBIFS \BOOTENV_SHARED_EFI \
@@ -423,6 +449,7 @@ BOOT_TARGET_DEVICES(BOOTENV_DEV) \ \"distro_bootcmd=" BOOTENV_SET_SCSI_NEED_INIT \ +BOOTENV_SET_NVME_NEED_INIT \"for target in ${boot_targets}; do " \"run bootcmd_${target}; " \"done\0"
Signature · 1 line
2.19.2
PATCH 1/1 distro_bootcmd: add NVME support
Quoted 11 lines · Heinrich Schuchardt
Some boards support NVME drives. We should be able to use them as boot devices.
NVME access requires running 'nvme scan'.
Signed-off-by Heinrich Schuchardt <[email protected]>--- include/config_distro_bootcmd.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
BUT
with CONFIG_BLK we can enumerate all block devices without all of this mess and we should be able to probe them too.
All nvme_scan_namespace() does is probe all the devices. We could do the same thing generically.
So, I suggest we simplify this distro stuff to scan CONFIG_BLK and we can drop most of the code and complexity.
Regards,
Simon
PATCH 1/1 distro_bootcmd: add NVME support
Quoted 17 lines · Simon Glass
Quoted 11 lines · Heinrich Schuchardt
Some boards support NVME drives. We should be able to use them as boot devices.
NVME access requires running 'nvme scan'.
Signed-off-by Heinrich Schuchardt <[email protected]>--- include/config_distro_bootcmd.h | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)Reviewed-by Simon Glass <[email protected]>BUT
Quoted 8 lines
with
CONFIG_BLKwe can enumerate all block devices without all of this mess and we should be able to probe them too.All
nvme_scan_namespace()does is probe all the devices. We could do the same thing generically.So, I suggest we simplify this distro stuff to scan
CONFIG_BLKand we can drop most of the code and complexity.
I think that's a great idea. We would need some new command for that though. Something like "blk"?
Given that this is bigger rework, I'll apply this patch as interim stop-gap regardless - booting from NVMe is useful today.
Going forward we should then move to a new, more generic block storage access command.
Alex