drivers: disk: nvme: allow building of nvme without mmu
Some SoCs do not have MMUs. Create a new KConfig that `NVME_PRP_PAGE_SIZE` that will define the PRP page size, and will default to `MMU_PAGE_SIZE` if there is a MMU. Otherwise, it defaults to 0x1000. Signed-off-by: Ryan McClelland <ryanmcclelland@meta.com>
This commit is contained in:
parent
46f5e7b722
commit
2b5c2748f6
3 changed files with 14 additions and 7 deletions
|
@ -52,6 +52,13 @@ config NVME_REQUEST_TIMEOUT
|
|||
This sets the waiting time for a request to succeed.
|
||||
Do not touch this unless you know what you are doing.
|
||||
|
||||
config NVME_PRP_PAGE_SIZE
|
||||
hex "NVMe PRP Page Size"
|
||||
default MMU_PAGE_SIZE if MMU
|
||||
default 0x1000
|
||||
help
|
||||
Set the PRP page size. If MMU is enabled, this will default to the MMU page size.
|
||||
|
||||
config NVME_PRP_LIST_AMOUNT
|
||||
int "Number of allocated PRP list"
|
||||
default 2
|
||||
|
|
|
@ -576,13 +576,13 @@ static int compute_n_prp(uintptr_t addr, uint32_t size)
|
|||
|
||||
/* See Common Command Format, Data Pointer (DPTR) field */
|
||||
|
||||
n_prp = size / CONFIG_MMU_PAGE_SIZE;
|
||||
n_prp = size / CONFIG_NVME_PRP_PAGE_SIZE;
|
||||
if (n_prp == 0) {
|
||||
n_prp = 1;
|
||||
}
|
||||
|
||||
if (size != CONFIG_MMU_PAGE_SIZE) {
|
||||
size = size % CONFIG_MMU_PAGE_SIZE;
|
||||
if (size != CONFIG_NVME_PRP_PAGE_SIZE) {
|
||||
size = size % CONFIG_NVME_PRP_PAGE_SIZE;
|
||||
}
|
||||
|
||||
if (n_prp == 1) {
|
||||
|
|
|
@ -309,14 +309,14 @@ enum nvme_feature {
|
|||
#define CACHE_LINE_SIZE CONFIG_DCACHE_LINE_SIZE
|
||||
#endif
|
||||
|
||||
#define NVME_PBAO_MASK (CONFIG_MMU_PAGE_SIZE - 1)
|
||||
#define NVME_PBAO_MASK (CONFIG_NVME_PRP_PAGE_SIZE - 1)
|
||||
|
||||
#define NVME_PRP_NEXT_PAGE(_addr) \
|
||||
((_addr & ~NVME_PBAO_MASK) + CONFIG_MMU_PAGE_SIZE)
|
||||
((_addr & ~NVME_PBAO_MASK) + CONFIG_NVME_PRP_PAGE_SIZE)
|
||||
|
||||
struct nvme_prp_list {
|
||||
uintptr_t prp[CONFIG_MMU_PAGE_SIZE / sizeof(uintptr_t)]
|
||||
__aligned(CONFIG_MMU_PAGE_SIZE);
|
||||
uintptr_t prp[CONFIG_NVME_PRP_PAGE_SIZE / sizeof(uintptr_t)]
|
||||
__aligned(CONFIG_NVME_PRP_PAGE_SIZE);
|
||||
sys_dnode_t node;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue