summaryrefslogtreecommitdiffhomepage
path: root/Private/Drivers
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-03-01 09:37:23 +0100
committerAmlal El Mahrouss <amlalelmahrouss@icloud.com>2024-03-01 09:37:23 +0100
commit374d341bf0216294b58f0198dbe4ba986464563f (patch)
treead9fb1a0b02f40f566f09d36531060780457d249 /Private/Drivers
parentc3e8cddf8c689807097f6f956d45e3ba96afec20 (diff)
:boom: See below.
HCoreLdr: Start effort to load HCoreKrnl in case of a non-installer scenario. HCoreKrnl: Start working on disk abstraction (AHCI) and rework PE format header file. Signed-off-by: Amlal El Mahrouss <amlalelmahrouss@icloud.com>
Diffstat (limited to 'Private/Drivers')
-rw-r--r--Private/Drivers/ACPI/.gitkeep0
-rw-r--r--Private/Drivers/ACPI/ACPI.hpp67
-rw-r--r--Private/Drivers/ACPI/ACPIManager.hxx44
-rw-r--r--Private/Drivers/ACPI/compile_flags.txt4
-rw-r--r--Private/Drivers/AHCI/API.hxx7
5 files changed, 122 insertions, 0 deletions
diff --git a/Private/Drivers/ACPI/.gitkeep b/Private/Drivers/ACPI/.gitkeep
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/Private/Drivers/ACPI/.gitkeep
diff --git a/Private/Drivers/ACPI/ACPI.hpp b/Private/Drivers/ACPI/ACPI.hpp
new file mode 100644
index 00000000..1a4329fc
--- /dev/null
+++ b/Private/Drivers/ACPI/ACPI.hpp
@@ -0,0 +1,67 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#ifndef __ACPI__
+#define __ACPI__
+
+/**
+ https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html
+ https://wiki.osdev.org/RSDT
+*/
+
+#include <NewKit/Defines.hpp>
+
+namespace HCore {
+class SDT {
+ public:
+ Char Signature[4];
+ UInt32 Length;
+ UInt8 Revision;
+ Char Checksum;
+ Char OemId[6];
+ Char OemTableId[8];
+ UInt32 OemRev;
+ UInt32 CreatorID;
+ UInt32 CreatorRevision;
+};
+
+class RSDP : public SDT {
+ public:
+ UInt32 RsdtAddress;
+ UIntPtr XsdtAddress;
+ UInt8 ExtendedChecksum;
+ UInt8 Reserved0[3];
+};
+
+class ConfigHeader {
+ public:
+ UInt64 BaseAddress;
+ UInt16 PciSegGroup;
+ UInt8 StartBus;
+ UInt8 EndBus;
+ UInt32 Reserved;
+};
+
+enum class AddressSpace : UInt8 {
+ SystemMemory = 0,
+ SystemIO = 1,
+ Pci = 2,
+ Controller = 3,
+ SmBus = 4,
+ Invalid = 0xFF,
+};
+
+class Address {
+ public:
+ AddressSpace AddressSpaceId;
+ UInt8 RegisterBitWidth;
+ UInt8 RegisterBitOffset;
+ UInt8 Reserved;
+ UIntPtr Address;
+};
+} // namespace HCore
+
+#endif // !__ACPI__
diff --git a/Private/Drivers/ACPI/ACPIManager.hxx b/Private/Drivers/ACPI/ACPIManager.hxx
new file mode 100644
index 00000000..dc3dd573
--- /dev/null
+++ b/Private/Drivers/ACPI/ACPIManager.hxx
@@ -0,0 +1,44 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#ifndef __ACPI_MANAGER__
+#define __ACPI_MANAGER__
+
+#include <Drivers/ACPI/ACPI.hpp>
+#include <KernelKit/DebugOutput.hpp>
+#include <NewKit/Defines.hpp>
+#include <NewKit/Ref.hpp>
+
+namespace HCore {
+class ACPIManager final {
+ public:
+ explicit ACPIManager(voidPtr rsdptr);
+ ~ACPIManager() = default;
+
+ ACPIManager &operator=(const ACPIManager &) = default;
+ ACPIManager(const ACPIManager &) = default;
+
+ public:
+ void Shutdown(); // shutdown
+ void Reset(); // soft-reboot
+
+ ErrorOr<voidPtr> Find(const char *signature);
+
+ bool Checksum(const char *checksum, SSizeT len); // watch for collides!
+
+ public:
+ ErrorOr<voidPtr> operator[](const char *signature) {
+ return this->Find(signature);
+ }
+
+ private:
+ VoidPtr m_Rsdp; // pointer to root descriptor.
+ SSizeT m_Entries; // number of entries, -1 tells that no invalid entries were
+ // found.
+};
+} // namespace HCore
+
+#endif // !__ACPI_MANAGER__
diff --git a/Private/Drivers/ACPI/compile_flags.txt b/Private/Drivers/ACPI/compile_flags.txt
new file mode 100644
index 00000000..1bc51142
--- /dev/null
+++ b/Private/Drivers/ACPI/compile_flags.txt
@@ -0,0 +1,4 @@
+-I./
+-I../
+-I../../
+-std=c++20
diff --git a/Private/Drivers/AHCI/API.hxx b/Private/Drivers/AHCI/API.hxx
index 8b137891..2a02b434 100644
--- a/Private/Drivers/AHCI/API.hxx
+++ b/Private/Drivers/AHCI/API.hxx
@@ -1 +1,8 @@
+/* -------------------------------------------
+
+ Copyright Mahrouss Logic
+
+------------------------------------------- */
+
+#pragma once