summaryrefslogtreecommitdiffhomepage
path: root/dev/kernel/KernelKit/PCI/Iterator.h
blob: 743e73eac7d344b71e75d18af92db14ba734b4fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* -------------------------------------------

  Copyright (C) 2024-2025, Amlal El Mahrouss, licensed under the Apache 2.0 license.

------------------------------------------- */

#ifndef __PCI_ITERATOR_H__
#define __PCI_ITERATOR_H__

#include <KernelKit/PCI/Database.h>
#include <KernelKit/PCI/Device.h>
#include <NeKit/Array.h>
#include <NeKit/Defines.h>
#include <NeKit/Ref.h>

#define NE_BUS_COUNT (256)
#define NE_DEVICE_COUNT (33)
#define NE_FUNCTION_COUNT (8)

namespace Kernel::PCI {
class Iterator final {
 public:
  Iterator() = delete;

 public:
  explicit Iterator(const Types::PciDeviceKind deviceType, UInt32 bar);

  Iterator& operator=(const Iterator&) = default;
  Iterator(const Iterator&)            = default;

  ~Iterator();

 public:
  Ref<PCI::Device> operator[](const Size& sz);

 private:
  Array<PCI::Device, NE_BUS_COUNT> fDevices;
};
}  // namespace Kernel::PCI

#endif  // __PCI_ITERATOR_H__