diff options
| author | Amlal <amlal.elmahrouss@icloud.com> | 2025-01-24 10:38:36 +0100 |
|---|---|---|
| committer | Amlal <amlal.elmahrouss@icloud.com> | 2025-01-24 10:38:36 +0100 |
| commit | 7b4bd3577a31d0f0adc7371840642791ae1567f4 (patch) | |
| tree | 1a8afc973aaa739d0d763315cad2fd376d1cea9c /dev/Mod/ACPI/ACPIFactoryInterface.h | |
ADD: Open version, with important changes kept out.
Signed-off-by: Amlal <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Mod/ACPI/ACPIFactoryInterface.h')
| -rw-r--r-- | dev/Mod/ACPI/ACPIFactoryInterface.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/dev/Mod/ACPI/ACPIFactoryInterface.h b/dev/Mod/ACPI/ACPIFactoryInterface.h new file mode 100644 index 00000000..2153a409 --- /dev/null +++ b/dev/Mod/ACPI/ACPIFactoryInterface.h @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#ifndef __MOD_ACPI_H__ +#define __MOD_ACPI_H__ + +#include <KernelKit/DebugOutput.h> +#include <Mod/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{nullptr}; // pointer to root descriptor. + SSizeT fEntries{0UL}; // number of entries, -1 tells that no invalid entries were + // found. + }; +} // namespace Kernel + +#endif // !__MOD_ACPI_H__ |
