]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
common: spl: Add spl NVMe boot support
authorMayuresh Chitale <mchitale@ventanamicro.com>
Sat, 3 Jun 2023 14:02:56 +0000 (19:32 +0530)
committerTom Rini <trini@konsulko.com>
Mon, 19 Jun 2023 21:47:41 +0000 (17:47 -0400)
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>
arch/riscv/include/asm/spl.h
common/spl/Makefile
common/spl/spl_nvme.c [new file with mode: 0644]

index 2898a770ee27c1ccd050eb6d134b2a435a484af8..9c0bf9755c99c68750522cdcdb6662723d169710 100644 (file)
@@ -20,6 +20,7 @@ enum {
        BOOT_DEVICE_SPI,
        BOOT_DEVICE_USB,
        BOOT_DEVICE_SATA,
+       BOOT_DEVICE_NVME,
        BOOT_DEVICE_I2C,
        BOOT_DEVICE_BOARD,
        BOOT_DEVICE_DFU,
index 5210ad0248c1f53d8c767d63598761def6e2d231..bad2bbf6cf1b2bdc41f640ce11ec7bd47b24c6f4 100644 (file)
@@ -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 (file)
index 0000000..2af63f1
--- /dev/null
@@ -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);