diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-01 12:29:05 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-01 12:29:05 +0100 |
| commit | 31698c31a8a48f77a64e97baa5297633b18221e5 (patch) | |
| tree | 3f10b13f7d6a166fbc61eac5511d026b8d9514c6 /dev | |
| parent | 3d718f14b33727cd04599e24c182098e06371871 (diff) | |
ADD: Add PowerFactory class.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev')
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc | 8 | ||||
| -rw-r--r-- | dev/Kernel/KernelKit/DebugOutput.h | 4 | ||||
| -rw-r--r-- | dev/Mod/ACPI/ACPIFactoryInterface.h | 6 | ||||
| -rw-r--r-- | dev/Mod/Pwr/PowerFactory.h | 35 |
4 files changed, 43 insertions, 10 deletions
diff --git a/dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc b/dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc index 27dfddaa..17ccf07e 100644 --- a/dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc +++ b/dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc @@ -87,14 +87,10 @@ namespace NeOS { } - Void ACPIFactoryInterface::Shutdown() + Bool ACPIFactoryInterface::Shutdown() { failed_to_shutdown: - // in case no acpi mode, or it's not available. - while (Yes) - { - asm volatile("cli; hlt"); - } + return NO; } /// @brief Reboot machine in either ACPI or by triple faulting. diff --git a/dev/Kernel/KernelKit/DebugOutput.h b/dev/Kernel/KernelKit/DebugOutput.h index ebbda7ef..1ac05665 100644 --- a/dev/Kernel/KernelKit/DebugOutput.h +++ b/dev/Kernel/KernelKit/DebugOutput.h @@ -197,9 +197,9 @@ namespace NeOS Int16 fPortCnt; }; - inline TerminalDevice& operator<<(TerminalDevice& src, auto number) + inline TerminalDevice& operator<<(TerminalDevice& src, const Long& num) { - number(number, src); + src = number(num); return src; } } // namespace NeOS diff --git a/dev/Mod/ACPI/ACPIFactoryInterface.h b/dev/Mod/ACPI/ACPIFactoryInterface.h index 01143c17..eb8d7353 100644 --- a/dev/Mod/ACPI/ACPIFactoryInterface.h +++ b/dev/Mod/ACPI/ACPIFactoryInterface.h @@ -12,14 +12,16 @@ #include <NewKit/ErrorOr.h> #include <NewKit/Defines.h> #include <NewKit/Ref.h> +#include <Mod/Pwr/PowerFactory.h> namespace NeOS { + class PowerFactory; class ACPIFactoryInterface; typedef ACPIFactoryInterface PowerFactoryInterface; - class ACPIFactoryInterface final + class ACPIFactoryInterface final : public PowerFactory { public: explicit ACPIFactoryInterface(voidPtr rsp_ptr); @@ -29,7 +31,7 @@ namespace NeOS ACPIFactoryInterface(const ACPIFactoryInterface&) = default; public: - Void Shutdown(); // shutdown + Bool Shutdown(); // shutdown Void Reboot(); // soft-reboot public: diff --git a/dev/Mod/Pwr/PowerFactory.h b/dev/Mod/Pwr/PowerFactory.h new file mode 100644 index 00000000..2992fac1 --- /dev/null +++ b/dev/Mod/Pwr/PowerFactory.h @@ -0,0 +1,35 @@ +/* ------------------------------------------- + + Copyright (C) 2025, Amlal EL Mahrouss, all rights reserved. + +------------------------------------------- */ + +#pragma once + +#include <KernelKit/DebugOutput.h> +#include <Mod/ACPI/ACPI.h> +#include <NewKit/ErrorOr.h> +#include <NewKit/Defines.h> +#include <NewKit/Ref.h> + +namespace NeOS +{ + class PowerFactory; + + class PowerFactory + { + public: + explicit PowerFactory() = default; + virtual ~PowerFactory() = default; + + PowerFactory& operator=(const PowerFactory&) = default; + PowerFactory(const PowerFactory&) = default; + + public: + Bool Shutdown() + { + return NO; + }; // shutdown + Void Reboot(){}; // soft-reboot + }; +} // namespace NeOS
\ No newline at end of file |
