From 31698c31a8a48f77a64e97baa5297633b18221e5 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 1 Mar 2025 12:29:05 +0100 Subject: ADD: Add PowerFactory class. Signed-off-by: Amlal El Mahrouss --- dev/Kernel/HALKit/AMD64/HalACPIFactoryInterface.cc | 8 ++--- dev/Kernel/KernelKit/DebugOutput.h | 4 +-- dev/Mod/ACPI/ACPIFactoryInterface.h | 6 ++-- dev/Mod/Pwr/PowerFactory.h | 35 ++++++++++++++++++++++ 4 files changed, 43 insertions(+), 10 deletions(-) create mode 100644 dev/Mod/Pwr/PowerFactory.h (limited to 'dev') 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 #include #include +#include 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 +#include +#include +#include +#include + +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 -- cgit v1.2.3