summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/AMD64/PCI/Iterator.cc
diff options
context:
space:
mode:
authorAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:13 +0100
committerAmlal <amlalelmahrouss@icloud.com>2024-12-21 21:59:45 +0100
commit610f91d87152cbe48d3054fcf437d8239da6ef35 (patch)
treea386f7047ab73d088169ab2371ddc6ffe8020f1c /dev/Kernel/HALKit/AMD64/PCI/Iterator.cc
parent509fcca5986651c8ba712fb395f8498f2dea4109 (diff)
IMP: :boom: Breaking changes some checks are needed to be done.
Signed-off-by: Amlal <amlalelmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/AMD64/PCI/Iterator.cc')
-rw-r--r--dev/Kernel/HALKit/AMD64/PCI/Iterator.cc41
1 files changed, 41 insertions, 0 deletions
diff --git a/dev/Kernel/HALKit/AMD64/PCI/Iterator.cc b/dev/Kernel/HALKit/AMD64/PCI/Iterator.cc
new file mode 100644
index 00000000..d87482ab
--- /dev/null
+++ b/dev/Kernel/HALKit/AMD64/PCI/Iterator.cc
@@ -0,0 +1,41 @@
+/* -------------------------------------------
+
+ Copyright (C) 2024, TQ B.V, all rights reserved.
+
+------------------------------------------- */
+
+#include <KernelKit/PCI/Iterator.h>
+
+namespace Kernel::PCI
+{
+ Iterator::Iterator(const Types::PciDeviceKind& type)
+ {
+ // probe devices.
+ for (int bus = 0; bus < ZKA_BUS_COUNT; ++bus)
+ {
+ for (int device = 0; device < ZKA_DEVICE_COUNT; ++device)
+ {
+ for (int function = 0; function < ZKA_FUNCTION_COUNT; ++function)
+ {
+ auto bar = 0x00;
+
+ Device dev(bus, device, function, bar);
+
+ if (dev.Class() == (UChar)type)
+ {
+ fDevices[bus] = dev;
+ }
+ }
+ }
+ }
+ }
+
+ Iterator::~Iterator()
+ {
+ }
+
+ Ref<PCI::Device> Iterator::operator[](const Size& at)
+ {
+ return fDevices[at];
+ }
+} // namespace Kernel::PCI