Skip to content

Commit b7d4d74

Browse files
Tomasz Bursztykacarlescufi
Tomasz Bursztyka
authored andcommitted
drivers/disk: Add NVMe controller support
Based on FreeBSD's implementation made by James Harris, Intel Copyright 2012-2016. Since Zephyr does not propose any advanced interfaces as FreeBSD (bus abstractions, memory and DMA abstraction and many more), this comes with a much simplified and Zephyr-ish way to instanciate, initialize and use NVMe controller. ToDo: IO Queues cannot be more than 1. Macros will need to be improved to manage the case of 2+ IO queues. Signed-off-by: Tomasz Bursztyka <[email protected]>
1 parent ad4458e commit b7d4d74

File tree

8 files changed

+1278
-0
lines changed

8 files changed

+1278
-0
lines changed

drivers/disk/CMakeLists.txt

+2
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,6 @@ zephyr_library_sources_ifdef(CONFIG_SDMMC_STM32 sdmmc_stm32.c)
1212
zephyr_library_sources_ifdef(CONFIG_SDMMC_SUBSYS sdmmc_subsys.c)
1313
zephyr_library_sources_ifdef(CONFIG_MMC_SUBSYS mmc_subsys.c)
1414

15+
add_subdirectory_ifdef(CONFIG_NVME nvme)
16+
1517
endif()

drivers/disk/Kconfig

+2
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ source "drivers/disk/Kconfig.flash"
1313
source "drivers/disk/Kconfig.sdmmc"
1414
source "drivers/disk/Kconfig.mmc"
1515

16+
rsource "nvme/Kconfig"
17+
1618
endif # DISK_DRIVERS

drivers/disk/nvme/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2022 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library_sources(nvme_controller.c)

drivers/disk/nvme/Kconfig

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright (c) 2022 Intel Corporation
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
menuconfig NVME
5+
bool "NVMe disk"
6+
depends on PCIE
7+
select PCIE_MSI_X
8+
select PCIE_MSI_MULTI_VECTOR
9+
help
10+
NVMe disk(s) might be present on the system through PCIe, enable this
11+
driver to support these. It will enable MSI-X and MSI multi-vector
12+
support
13+
14+
if NVME
15+
16+
config NVME_ADMIN_ENTRIES
17+
int "Number of admin queue entries"
18+
range 2 4096
19+
default 256
20+
help
21+
This sets the amount of allocated admin queue entries.
22+
Do not touch this unless you know what you are doing.
23+
24+
config NVME_IO_QUEUES
25+
int "Number of IO queues"
26+
range 1 65536
27+
default 1
28+
help
29+
This sets the amount of allocated I/O queues.
30+
Do not touch this unless you know what you are doing.
31+
32+
config NVME_IO_ENTRIES
33+
int "Number of IO queue entries"
34+
range 2 65536
35+
default 256
36+
help
37+
This sets the amount of allocated IO queue entries.
38+
Do not touch this unless you know what you are doing.
39+
40+
config NVME_INT_PRIORITY
41+
int "Interrupt priority"
42+
default 2
43+
help
44+
Interrupt priority used for the MSI-X generated interrupts.
45+
46+
module = NVME
47+
module-str = nvme
48+
source "subsys/logging/Kconfig.template.log_config"
49+
50+
endif # NVME

0 commit comments

Comments
 (0)