summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/KernelKit/PCI/Device.h
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:13:48 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:15:17 +0100
commita13e1c0911c0627184bc38f18c7fdda64447b3ad (patch)
tree073a62c09bf216e85a3f310376640fa1805147f9 /dev/Kernel/KernelKit/PCI/Device.h
parent149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff)
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/KernelKit/PCI/Device.h')
-rw-r--r--dev/Kernel/KernelKit/PCI/Device.h81
1 files changed, 0 insertions, 81 deletions
diff --git a/dev/Kernel/KernelKit/PCI/Device.h b/dev/Kernel/KernelKit/PCI/Device.h
deleted file mode 100644
index 9870f618..00000000
--- a/dev/Kernel/KernelKit/PCI/Device.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-#pragma once
-
-#include <NewKit/Defines.h>
-
-namespace NeOS::PCI
-{
- enum class PciConfigKind : UShort
- {
- ConfigAddress = 0xCF8,
- ConfigData = 0xCFC,
- CommandReg = 0x0004,
- Invalid = 0xFFFF,
- };
-
- class Device final
- {
- public:
- Device() = default;
-
- public:
- explicit Device(UShort bus, UShort device, UShort function, UInt32 bar);
-
- Device& operator=(const Device&) = default;
-
- Device(const Device&) = default;
-
- ~Device();
-
- public:
- UInt Read(UInt bar, Size szData);
- void Write(UInt bar, UIntPtr data, Size szData);
-
- public:
- operator bool();
-
- public:
- template <typename T>
- UInt Read(UInt bar)
- {
- static_assert(sizeof(T) <= 4, "64-bit PCI addressing is unsupported");
- return Read(bar, sizeof(T));
- }
-
- template <typename T>
- void Write(UInt bar, UIntPtr data)
- {
- static_assert(sizeof(T) <= 4, "64-bit PCI addressing is unsupported");
- Write(bar, data, sizeof(T));
- }
-
- public:
- UShort DeviceId();
- UShort VendorId();
- UShort InterfaceId();
- UChar Class();
- UChar Subclass();
- UChar ProgIf();
- UChar HeaderType();
- UIntPtr Bar(UInt32 bar_in);
-
- public:
- void EnableMmio(UInt32 bar_in);
- void BecomeBusMaster(UInt32 bar_in); // for PCI-DMA, PC-DMA does not need that.
-
- UShort Vendor();
-
- private:
- UShort fBus;
- UShort fDevice;
- UShort fFunction;
- UInt32 fBar;
- };
-} // namespace NeOS::PCI
-
-EXTERN_C void NewOSPCISetCfgTarget(NeOS::UInt bar);
-EXTERN_C NeOS::UInt NewOSPCIReadRaw(NeOS::UInt bar);