From d48cbe75ef29a9c67c9d176bf58e56ea6448fb9e Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Mon, 21 Oct 2024 20:23:36 +0200 Subject: IMP: Major refactor of header and source files extensions. Signed-off-by: Amlal El Mahrouss --- dev/modules/ACPI/ACPI.h | 88 +++++++++++++++++++++++++++++++ dev/modules/ACPI/ACPI.hxx | 88 ------------------------------- dev/modules/ACPI/ACPIFactoryInterface.h | 60 +++++++++++++++++++++ dev/modules/ACPI/ACPIFactoryInterface.hxx | 60 --------------------- 4 files changed, 148 insertions(+), 148 deletions(-) create mode 100644 dev/modules/ACPI/ACPI.h delete mode 100644 dev/modules/ACPI/ACPI.hxx create mode 100644 dev/modules/ACPI/ACPIFactoryInterface.h delete mode 100644 dev/modules/ACPI/ACPIFactoryInterface.hxx (limited to 'dev/modules/ACPI') diff --git a/dev/modules/ACPI/ACPI.h b/dev/modules/ACPI/ACPI.h new file mode 100644 index 00000000..3049d3c1 --- /dev/null +++ b/dev/modules/ACPI/ACPI.h @@ -0,0 +1,88 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#ifndef __ACPI__ +#define __ACPI__ + +/** + https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html +*/ + +#include + +namespace Kernel +{ + class PACKED SDT + { + public: + Char Signature[4]; + UInt32 Length; + UInt8 Revision; + Char Checksum; + Char OemId[6]; + Char OemTableId[8]; + UInt32 OemRev; + UInt32 CreatorID; + UInt32 CreatorRevision; + }; + + class PACKED RSDP : public SDT + { + public: + UInt32 RsdtAddress; + UIntPtr XsdtAddress; + UInt8 ExtendedChecksum; + UInt8 Reserved0[3]; + }; + + class PACKED ConfigHeader + { + public: + UInt64 BaseAddress; + UInt16 PciSegGroup; + UInt8 StartBus; + UInt8 EndBus; + UInt32 Reserved; + }; + + enum ACPI_ADDRESS_SPACE_KIND : UInt8 + { + eSystemMemory = 0, + eSystemIO = 1, + ePci = 2, + eController = 3, + eSmBus = 4, + eCount = 5, + eInvalid = 0xFF, + }; + + class PACKED ACPI_ADDRESS final + { + public: + UInt8 AddressSpaceId; + UInt8 RegisterBitWidth; + UInt8 RegisterBitOffset; + UInt8 Reserved; + UIntPtr Address; + }; + + class PACKED RSDT final + { + public: + Char Signature[4]; + UInt32 Length; + UInt8 Revision; + Char Checksum; + Char OemId[6]; + Char OemTableId[8]; + UInt32 OemRev; + UInt32 CreatorID; + UInt32 CreatorRevision; + UInt32 AddressArr[]; + }; +} // namespace Kernel + +#endif // !__ACPI__ diff --git a/dev/modules/ACPI/ACPI.hxx b/dev/modules/ACPI/ACPI.hxx deleted file mode 100644 index 6ddb00a8..00000000 --- a/dev/modules/ACPI/ACPI.hxx +++ /dev/null @@ -1,88 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#ifndef __ACPI__ -#define __ACPI__ - -/** - https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html -*/ - -#include - -namespace Kernel -{ - class PACKED SDT - { - public: - Char Signature[4]; - UInt32 Length; - UInt8 Revision; - Char Checksum; - Char OemId[6]; - Char OemTableId[8]; - UInt32 OemRev; - UInt32 CreatorID; - UInt32 CreatorRevision; - }; - - class PACKED RSDP : public SDT - { - public: - UInt32 RsdtAddress; - UIntPtr XsdtAddress; - UInt8 ExtendedChecksum; - UInt8 Reserved0[3]; - }; - - class PACKED ConfigHeader - { - public: - UInt64 BaseAddress; - UInt16 PciSegGroup; - UInt8 StartBus; - UInt8 EndBus; - UInt32 Reserved; - }; - - enum ACPI_ADDRESS_SPACE_KIND : UInt8 - { - eSystemMemory = 0, - eSystemIO = 1, - ePci = 2, - eController = 3, - eSmBus = 4, - eCount = 5, - eInvalid = 0xFF, - }; - - class PACKED ACPI_ADDRESS final - { - public: - UInt8 AddressSpaceId; - UInt8 RegisterBitWidth; - UInt8 RegisterBitOffset; - UInt8 Reserved; - UIntPtr Address; - }; - - class PACKED RSDT final - { - public: - Char Signature[4]; - UInt32 Length; - UInt8 Revision; - Char Checksum; - Char OemId[6]; - Char OemTableId[8]; - UInt32 OemRev; - UInt32 CreatorID; - UInt32 CreatorRevision; - UInt32 AddressArr[]; - }; -} // namespace Kernel - -#endif // !__ACPI__ diff --git a/dev/modules/ACPI/ACPIFactoryInterface.h b/dev/modules/ACPI/ACPIFactoryInterface.h new file mode 100644 index 00000000..f3f041fc --- /dev/null +++ b/dev/modules/ACPI/ACPIFactoryInterface.h @@ -0,0 +1,60 @@ +/* ------------------------------------------- + + Copyright ZKA Web Services Co. + +------------------------------------------- */ + +#ifndef __MOD_ACPI_HXX__ +#define __MOD_ACPI_HXX__ + +#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_HXX__ diff --git a/dev/modules/ACPI/ACPIFactoryInterface.hxx b/dev/modules/ACPI/ACPIFactoryInterface.hxx deleted file mode 100644 index ba715e76..00000000 --- a/dev/modules/ACPI/ACPIFactoryInterface.hxx +++ /dev/null @@ -1,60 +0,0 @@ -/* ------------------------------------------- - - Copyright ZKA Web Services Co. - -------------------------------------------- */ - -#ifndef __MOD_ACPI_HXX__ -#define __MOD_ACPI_HXX__ - -#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_HXX__ -- cgit v1.2.3