Skip to content

obamas-lastname/nvme-driver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NVMe Driver

Portable NVMe controller/namespace driver core with a small OS-dependency layer (“osdeps”).
This repository ships the core and a standalone osdeps contract so you can drop it into your OS/kernel/runtime with minimal glue.

Layout

.
├── include/
│   ├── nvme.h
│   ├── nvme_hw.h
│   └── nvme_osdeps.h
├── src/
│   └── nvme.c
└── osdeps/
    ├── standalone/
    │   └── nvme_osdeps_impl.h
    └── lykos/
        └── nvme_osdeps_impl.h

Requirements

  • A C compiler (GCC/Clang)
  • Meson + Ninja for building the library

The default build targets the standalone osdeps contract and does not require any external kernel headers.

Build (public / standalone)

This produces libnvme.a and installs headers under nvme/.

meson setup build -Dosdeps=standalone
ninja -C build

Using the standalone osdeps contract

The standalone osdeps header (osdeps/standalone/nvme_osdeps_impl.h) declares the minimal platform surface the driver expects.

You must provide implementations for (see the header for the authoritative list):

Logging / assertions

nvme_log(int level, const char *fmt, ...)
panic(const char *fmt, ...) (noreturn)

Memory / sync

vm_alloc(size_t)
heap_alloc(size_t), heap_free(void*)
spinlock_acquire(spinlock_t*), spinlock_release(spinlock_t*)
arch_lcpu_relax(void)

MMIO / DMA

mmio_map(uintptr_t phys, size_t size)
dma_alloc(size_t) -> dma_buf_t { vaddr, paddr, size }
dma_free(dma_buf_t*)

Drive glue (optional integration)

The current driver integrates with a simple drive_t structure (see standalone osdeps header) and expects:

drive_create(int type)
drive_mount(drive_t*)

About

Drop-in NVMe driver core: controller + namespace bring-up, queues, identify, and I/O. Port via a thin osdeps layer.

Topics

Resources

License

Stars

Watchers

Forks

Contributors