diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-10-21 20:23:36 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-10-21 20:23:36 +0200 |
| commit | d48cbe75ef29a9c67c9d176bf58e56ea6448fb9e (patch) | |
| tree | 89cbd6b7e23802f92bf3158868f4dc33c088e516 /dev/modules/ACPI/ACPIFactoryInterface.h | |
| parent | 21b3da78f806d6765f9dffa6a84c21346f171cee (diff) | |
IMP: Major refactor of header and source files extensions.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/modules/ACPI/ACPIFactoryInterface.h')
| -rw-r--r-- | dev/modules/ACPI/ACPIFactoryInterface.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/dev/modules/ACPI/ACPIFactoryInterface.h b/dev/modules/ACPI/ACPIFactoryInterface.h new file mode 100644 index 00000000..f3f041fc --- /dev/null +++ b/dev/modules/ACPI/ACPIFactoryInterface.h @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#ifndef __MOD_ACPI_HXX__ +#define __MOD_ACPI_HXX__ + +#include <KernelKit/DebugOutput.h> +#include <modules/ACPI/ACPI.h> +#include <NewKit/ErrorOr.h> +#include <NewKit/Defines.h> +#include <NewKit/Ref.h> + +namespace Kernel +{ + class ACPIFactoryInterface; + + typedef ACPIFactoryInterface PowerFactoryInterface; + + class ACPIFactoryInterface final + { + public: + explicit ACPIFactoryInterface(voidPtr rsp_ptr); + ~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<voidPtr> 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<voidPtr> operator[](const Char* signature) + { + return this->Find(signature); + } + + private: + VoidPtr fRsdp; // pointer to root descriptor. + SSizeT fEntries; // number of entries, -1 tells that no invalid entries were + // found. + }; +} // namespace Kernel + +#endif // !__MOD_ACPI_HXX__ |
