summaryrefslogtreecommitdiffhomepage
path: root/src/kernel/HALKit/AMD64/PCI/Iterator.cpp
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-02-19 08:14:48 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-02-19 08:14:48 +0100
commitf0acad6f3206079d804b2f59aace0dc32dbeb6dc (patch)
tree44116f2771ebf146ec016337ba07d0320575dae3 /src/kernel/HALKit/AMD64/PCI/Iterator.cpp
parent41117a33aa0dde66b8964b4bc0de0082fcd40667 (diff)
kernel: lots of tweaks and improvements, WIP: ASN, FileMgr support for OpenHeFS.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'src/kernel/HALKit/AMD64/PCI/Iterator.cpp')
-rw-r--r--src/kernel/HALKit/AMD64/PCI/Iterator.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/kernel/HALKit/AMD64/PCI/Iterator.cpp b/src/kernel/HALKit/AMD64/PCI/Iterator.cpp
new file mode 100644
index 00000000..8216befa
--- /dev/null
+++ b/src/kernel/HALKit/AMD64/PCI/Iterator.cpp
@@ -0,0 +1,28 @@
+// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
+// Licensed under the Apache License, Version 2.0 (see LICENSE file)
+// Official repository: https://github.com/nekernel-org/nekernel
+
+#include <KernelKit/PCI/Iterator.h>
+
+namespace Kernel::PCI {
+Iterator::Iterator(const Types::PciDeviceKind type, UInt32 bar) {
+ // probe devices.
+ for (Int32 bus = 0; bus < NE_BUS_COUNT; ++bus) {
+ for (Int32 device = 0; device < NE_DEVICE_COUNT; ++device) {
+ for (Int32 function = 0; function < NE_FUNCTION_COUNT; ++function) {
+ Device dev(bus, device, function, bar);
+
+ if (dev.Class() == type) {
+ fDevices[bus] = dev;
+ }
+ }
+ }
+ }
+}
+
+Iterator::~Iterator() {}
+
+Ref<PCI::Device> Iterator::operator[](const Size& at) {
+ return fDevices[at];
+}
+} // namespace Kernel::PCI