summaryrefslogtreecommitdiff
path: root/common/spl
diff options
context:
space:
mode:
authorMayuresh Chitale <mchitale@ventanamicro.com>2023-06-03 17:02:56 +0300
committerTom Rini <trini@konsulko.com>2023-06-20 00:47:41 +0300
commit02d9c0b0e5c95b0c8af475c4b8821abe62478419 (patch)
tree9074635ccd9362356f04ab59bcf23bb1867c1ea5 /common/spl
parent32f5e9e5c1a787b351ab087ebe284182cfd83188 (diff)
downloadu-boot-02d9c0b0e5c95b0c8af475c4b8821abe62478419.tar.xz
common: spl: Add spl NVMe boot support
Add support to load the next stage image from an NVMe disk which may be formatted as an EXT or FAT filesystem. Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com> [trini: Drop hunk changing disk/part.c as that breaks other users] Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common/spl')
-rw-r--r--common/spl/Makefile1
-rw-r--r--common/spl/spl_nvme.c32
2 files changed, 33 insertions, 0 deletions
diff --git a/common/spl/Makefile b/common/spl/Makefile
index 5210ad0248..bad2bbf6cf 100644
--- a/common/spl/Makefile
+++ b/common/spl/Makefile
@@ -29,6 +29,7 @@ obj-$(CONFIG_$(SPL_TPL_)USB_STORAGE) += spl_usb.o
obj-$(CONFIG_$(SPL_TPL_)FS_FAT) += spl_fat.o
obj-$(CONFIG_$(SPL_TPL_)FS_EXT4) += spl_ext.o
obj-$(CONFIG_$(SPL_TPL_)SATA) += spl_sata.o
+obj-$(CONFIG_$(SPL_TPL_)NVME) += spl_nvme.o
obj-$(CONFIG_$(SPL_TPL_)SEMIHOSTING) += spl_semihosting.o
obj-$(CONFIG_$(SPL_TPL_)DFU) += spl_dfu.o
obj-$(CONFIG_$(SPL_TPL_)SPI_LOAD) += spl_spi.o
diff --git a/common/spl/spl_nvme.c b/common/spl/spl_nvme.c
new file mode 100644
index 0000000000..2af63f1dc8
--- /dev/null
+++ b/common/spl/spl_nvme.c
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023
+ * Ventana Micro Systems Inc.
+ *
+ */
+
+#include <common.h>
+#include <spl.h>
+#include <init.h>
+#include <nvme.h>
+
+static int spl_nvme_load_image(struct spl_image_info *spl_image,
+ struct spl_boot_device *bootdev)
+{
+ int ret;
+
+ ret = pci_init();
+ if (ret < 0)
+ return ret;
+
+ ret = nvme_scan_namespace();
+ if (ret < 0)
+ return ret;
+
+ ret = spl_blk_load_image(spl_image, bootdev, UCLASS_NVME,
+ CONFIG_SPL_NVME_BOOT_DEVICE,
+ CONFIG_SYS_NVME_BOOT_PARTITION);
+ return ret;
+}
+
+SPL_LOAD_IMAGE_METHOD("NVME", 0, BOOT_DEVICE_NVME, spl_nvme_load_image);