summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
diff options
context:
space:
mode:
Diffstat (limited to 'dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx')
-rw-r--r--dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx60
1 files changed, 60 insertions, 0 deletions
diff --git a/dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx b/dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
new file mode 100644
index 00000000..6405dc1b
--- /dev/null
+++ b/dev/Kernel/Modules/ACPI/ACPIFactoryInterface.hxx
@@ -0,0 +1,60 @@
+/* -------------------------------------------
+
+ Copyright ZKA Technologies.
+
+------------------------------------------- */
+
+#ifndef __MOD_ACPI_HXX__
+#define __MOD_ACPI_HXX__
+
+#include <KernelKit/DebugOutput.hxx>
+#include <Modules/ACPI/ACPI.hxx>
+#include <NewKit/ErrorOr.hxx>
+#include <NewKit/Defines.hxx>
+#include <NewKit/Ref.hxx>
+
+namespace Kernel
+{
+ class ACPIFactoryInterface;
+
+ typedef ACPIFactoryInterface PowerFactoryInterface;
+
+ 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<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__