aboutsummaryrefslogtreecommitdiff
path: root/kernel/CMakeLists.txt
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-11-16 15:50:15 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-11-22 14:20:36 +0100
commita42ab28f65e3ef5926137ddf4c62b188c33ca440 (patch)
treef8684eb0354251e7bd9035dd53dcce9dd8cbf692 /kernel/CMakeLists.txt
parent45bf10f2ac489cc8253eb2f145c569edc16fc45a (diff)
downloadkernel-a42ab28f65e3ef5926137ddf4c62b188c33ca440.tar.xz
kernel-a42ab28f65e3ef5926137ddf4c62b188c33ca440.zip
kernel/devices: introduce PCI ecam_segment abstraction
Previously, ECAM access was implemented "in-place" inside the PCI scan function. This meant that any checks were ad-hoc and not easily reusable or testable. Therefore, this change introduces a dedicated, reusable abstraction for ECAM segment access. It validates segment descriptors received from the platform and ensures no out-of-bounds buses are accessed at runtime. Construction of an ecam_segment will always succeed. If the firmware or platform data does not describe a valid segment, the ecam_segment will behave as if it had a size of zero, with a kernel log indicating the invalid segment. Attempting to map a bus that is out-of-bounds for a given ecam_segment will return a runtime error. If the system's MMIO space is insufficient to accommodate the mapping of a valid bus in an ecam_segment, a runtime error will be returned. Furthermore, this change introduces the kernel::devices::pci namespace. PCI initialization and scanning functionality, previously hosted in kernel/kernel/devices/pci_express.{cpp,hpp}, has been relocated and renamed to kernel/kernel/devices/pci/init.{cpp,hpp}. The initialization function of the PCI subsystem has been renamed from kernel::devices::init_pci_express_devices to kernel::devices::pci::init. The observable behavior of the PCI scan remains unchanged. Tests have been added to validate the behavior of ecam_segment against its contract.
Diffstat (limited to 'kernel/CMakeLists.txt')
-rw-r--r--kernel/CMakeLists.txt3
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/CMakeLists.txt b/kernel/CMakeLists.txt
index 705f3a85..df65ed20 100644
--- a/kernel/CMakeLists.txt
+++ b/kernel/CMakeLists.txt
@@ -43,7 +43,8 @@ target_sources("kernel_lib" PRIVATE
# Device Subsystem
"kernel/devices/block_device_utils.cpp"
"kernel/devices/init.cpp"
- "kernel/devices/pci_express.cpp"
+ "kernel/devices/pci/ecam_segment.cpp"
+ "kernel/devices/pci/init.cpp"
"kernel/devices/pseudo.cpp"
"kernel/devices/storage.cpp"