diff options
| author | Richard Qin <richard.qin.x@gmail.com> | 2026-04-21 23:20:56 +0800 |
|---|---|---|
| committer | Richard Qin <richard.qin.x@gmail.com> | 2026-04-21 23:20:56 +0800 |
| commit | 92ac3931ec7c2ee7746d38499edd9179c943c5ac (patch) | |
| tree | f524c59467df9317cbf0a480fd542601a3f1c981 /na/drivers/plic.cc | |
| parent | f5272c51b11ec06627d748901c7747154f3bbf04 (diff) | |
| download | lume-92ac3931ec7c2ee7746d38499edd9179c943c5ac.tar.gz lume-92ac3931ec7c2ee7746d38499edd9179c943c5ac.tar.xz | |
feat: add initial implementation of PLIC and UART drivers
Diffstat (limited to 'na/drivers/plic.cc')
| -rw-r--r-- | na/drivers/plic.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/na/drivers/plic.cc b/na/drivers/plic.cc new file mode 100644 index 0000000..f640a2a --- /dev/null +++ b/na/drivers/plic.cc @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* Copyright (C) 2026 Richard Qin */ + +/* + * plic.cc — Platform-Level Interrupt Controller stub + */ + +#include <lume/fdt.h> +#include <lume/vmm.h> +#include <arch/config.h> + +void plic_init() { + /* + * In a fully implemented driver, we would discover the PLIC base + * and size via FDT. For now, we map the default QEMU virt PLIC. + */ + uint64 plic_pa = arch::kDefaultPlicPA; + /* QEMU virt PLIC is 0x4000000 in size */ + vmm_map_kernel_mmio(plic_pa, 0x4000000); +} + +void plic_init_ap() { + /* AP per-CPU init */ +} |
