From 486425ed00acec134f8799bdde64bfd093c5fb55 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Thu, 26 Dec 2024 21:19:14 +0100 Subject: IMPL: A lot of new changes, see details. Signed-off-by: Amlal El Mahrouss --- dev/Mod/ACPI/ACPIFactoryInterface.h | 60 +++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 dev/Mod/ACPI/ACPIFactoryInterface.h (limited to 'dev/Mod/ACPI/ACPIFactoryInterface.h') diff --git a/dev/Mod/ACPI/ACPIFactoryInterface.h b/dev/Mod/ACPI/ACPIFactoryInterface.h new file mode 100644 index 00000000..0a28bd95 --- /dev/null +++ b/dev/Mod/ACPI/ACPIFactoryInterface.h @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright (C) 2024, Theater Quality Inc, all rights reserved. + +------------------------------------------- */ + +#ifndef __MOD_ACPI_H__ +#define __MOD_ACPI_H__ + +#include +#include +#include +#include +#include + +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 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 fRsdp; // pointer to root descriptor. + SSizeT fEntries; // number of entries, -1 tells that no invalid entries were + // found. + }; +} // namespace Kernel + +#endif // !__MOD_ACPI_H__ -- cgit v1.2.3