From a8366afaf39321ae2bbae70740f5ca65bee06769 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sun, 17 Mar 2024 19:54:32 +0100 Subject: unrelated: Rework the ACPI interface. Signed-off-by: Amlal El Mahrouss --- Private/Builtins/ACPI/ACPIFactoryInterface.hxx | 52 ++++++++++++++++++++++++++ Private/Builtins/ACPI/ACPIManager.hxx | 44 ---------------------- Private/Builtins/README.TXT | 2 +- 3 files changed, 53 insertions(+), 45 deletions(-) create mode 100644 Private/Builtins/ACPI/ACPIFactoryInterface.hxx delete mode 100644 Private/Builtins/ACPI/ACPIManager.hxx (limited to 'Private/Builtins') diff --git a/Private/Builtins/ACPI/ACPIFactoryInterface.hxx b/Private/Builtins/ACPI/ACPIFactoryInterface.hxx new file mode 100644 index 00000000..21cd026e --- /dev/null +++ b/Private/Builtins/ACPI/ACPIFactoryInterface.hxx @@ -0,0 +1,52 @@ +/* ------------------------------------------- + + Copyright Mahrouss Logic + +------------------------------------------- */ + +#ifndef __ACPI_MANAGER__ +#define __ACPI_MANAGER__ + +#include +#include +#include +#include + +namespace HCore { +class ACPIFactoryInterface final { + public: + explicit ACPIFactoryInterface(voidPtr rsdPtr); + ~ACPIFactoryInterface() = default; + + ACPIFactoryInterface &operator=(const ACPIFactoryInterface &) = default; + ACPIFactoryInterface(const ACPIFactoryInterface &) = default; + + public: + void Shutdown(); // shutdown + void Reboot(); // soft-reboot + + public: + /// @brief Descriptor find factory. + /// @param signature The signature of the descriptor table (MADT, ACPI...) + /// @return the blob inside an ErrorOr object. + ErrorOr Find(const char *signature); + + /// @brief Checksum factory. + /// @param checksum the data to checksum + /// @param len it's size + /// @return if it succeed + bool Checksum(const char *checksum, SSizeT len); // watch for collides! + + public: + ErrorOr 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/Builtins/ACPI/ACPIManager.hxx b/Private/Builtins/ACPI/ACPIManager.hxx deleted file mode 100644 index 1fa5e714..00000000 --- a/Private/Builtins/ACPI/ACPIManager.hxx +++ /dev/null @@ -1,44 +0,0 @@ -/* ------------------------------------------- - - Copyright Mahrouss Logic - -------------------------------------------- */ - -#ifndef __ACPI_MANAGER__ -#define __ACPI_MANAGER__ - -#include -#include -#include -#include - -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 Find(const char *signature); - - bool Checksum(const char *checksum, SSizeT len); // watch for collides! - - public: - ErrorOr 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/Builtins/README.TXT b/Private/Builtins/README.TXT index ce39f472..2e341e5d 100644 --- a/Private/Builtins/README.TXT +++ b/Private/Builtins/README.TXT @@ -12,5 +12,5 @@ These are HCore builtins device drivers. Maintainers =========== -ACPIManager: Amlal EL Mahrouss +ACPIFactoryInterface: Amlal EL Mahrouss AHCI: Amlal EL Mahrouss \ No newline at end of file -- cgit v1.2.3