Mayuresh Chitale | bd05090 | 2023-06-03 19:32:56 +0530 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2023 |
| 4 | * Ventana Micro Systems Inc. |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <spl.h> |
| 10 | #include <init.h> |
| 11 | #include <nvme.h> |
| 12 | |
| 13 | static int spl_nvme_load_image(struct spl_image_info *spl_image, |
| 14 | struct spl_boot_device *bootdev) |
| 15 | { |
| 16 | int ret; |
| 17 | |
| 18 | ret = pci_init(); |
| 19 | if (ret < 0) |
| 20 | return ret; |
| 21 | |
| 22 | ret = nvme_scan_namespace(); |
| 23 | if (ret < 0) |
| 24 | return ret; |
| 25 | |
| 26 | ret = spl_blk_load_image(spl_image, bootdev, UCLASS_NVME, |
| 27 | CONFIG_SPL_NVME_BOOT_DEVICE, |
| 28 | CONFIG_SYS_NVME_BOOT_PARTITION); |
| 29 | return ret; |
| 30 | } |
| 31 | |
| 32 | SPL_LOAD_IMAGE_METHOD("NVME", 0, BOOT_DEVICE_NVME, spl_nvme_load_image); |