The Pedigree Project 0.1
nvme/Registers.h
1/* Copyright (c) 2026, Pedigree Developers. SPDX-License-Identifier: ISC */
2#ifndef NVME_REGISTERS_H
3#define NVME_REGISTERS_H
4#include "pedigree/kernel/processor/types.h"
5
6namespace Nvme {
7constexpr size_t PageSize = 4096;
8constexpr size_t QueueDepth = 16;
9constexpr size_t MaxTransfer = 65536;
10enum Register : size_t {
11 Cap = 0x00,
12 Version = 0x08,
13 InterruptMaskSet = 0x0c,
14 InterruptMaskClear = 0x10,
15 Configuration = 0x14,
16 Status = 0x1c,
17 AdminAttributes = 0x24,
18 AdminSubmission = 0x28,
19 AdminCompletion = 0x30,
20 Doorbells = 0x1000,
21};
22struct Command {
23 uint32_t opcode;
24 uint32_t nsid;
25 uint64_t reserved;
26 uint64_t metadata;
27 uint64_t prp1;
28 uint64_t prp2;
29 uint32_t cdw10;
30 uint32_t cdw11;
31 uint32_t cdw12;
32 uint32_t cdw13;
33 uint32_t cdw14;
34 uint32_t cdw15;
35};
36struct Completion {
37 uint32_t result;
38 uint32_t reserved;
39 uint16_t sqHead;
40 uint16_t sqId;
41 uint16_t cid;
42 uint16_t status;
43};
44static_assert(sizeof(Command) == 64);
45static_assert(sizeof(Completion) == 16);
46} // namespace Nvme
47#endif