diff options
Diffstat (limited to 'dev/modules/ACPI')
| -rw-r--r-- | dev/modules/ACPI/ACPI.h | 131 | ||||
| -rw-r--r-- | dev/modules/ACPI/ACPIFactoryInterface.h | 90 |
2 files changed, 106 insertions, 115 deletions
diff --git a/dev/modules/ACPI/ACPI.h b/dev/modules/ACPI/ACPI.h index 305c061c..40b393d5 100644 --- a/dev/modules/ACPI/ACPI.h +++ b/dev/modules/ACPI/ACPI.h @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. ------------------------------------------- */ @@ -8,83 +8,76 @@ #define __ACPI__ /** - https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html + https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html */ #include <NewKit/Defines.h> #define SDT_OBJECT : public Kernel::SDT -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; - }; +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 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; - }; +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, - }; +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 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[1]; - }; -} // namespace Kernel +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[1]; +}; +} // namespace Kernel -#endif // !__ACPI__ +#endif // !__ACPI__ diff --git a/dev/modules/ACPI/ACPIFactoryInterface.h b/dev/modules/ACPI/ACPIFactoryInterface.h index 10b8ccf1..0a10ffc2 100644 --- a/dev/modules/ACPI/ACPIFactoryInterface.h +++ b/dev/modules/ACPI/ACPIFactoryInterface.h @@ -1,6 +1,6 @@ /* ------------------------------------------- - Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. ------------------------------------------- */ @@ -8,52 +8,50 @@ #define __MOD_ACPI_H__ #include <KernelKit/DebugOutput.h> -#include <modules/ACPI/ACPI.h> -#include <NewKit/ErrorOr.h> #include <NewKit/Defines.h> +#include <NewKit/ErrorOr.h> #include <NewKit/Ref.h> +#include <modules/ACPI/ACPI.h> #include <modules/Power/PowerFactory.h> -namespace Kernel -{ - class PowerFactory; - class ACPIFactoryInterface; - - typedef ACPIFactoryInterface PowerFactoryInterface; - - class ACPIFactoryInterface final NE_POWER_FACTORY - { - public: - explicit ACPIFactoryInterface(voidPtr rsp_ptr); - ~ACPIFactoryInterface() = default; - - ACPIFactoryInterface& operator=(const ACPIFactoryInterface&) = default; - ACPIFactoryInterface(const ACPIFactoryInterface&) = default; - - public: - Bool 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); - - private: - VoidPtr fRsdp{nullptr}; // pointer to root descriptor. - SizeT fEntries{0UL}; // number of entries, -1 tells that no invalid entries were - // found. - }; -} // namespace Kernel - -#endif // !__MOD_ACPI_H__ +namespace Kernel { +class PowerFactory; +class ACPIFactoryInterface; + +typedef ACPIFactoryInterface PowerFactoryInterface; + +class ACPIFactoryInterface final NE_POWER_FACTORY { + public: + explicit ACPIFactoryInterface(voidPtr rsp_ptr); + ~ACPIFactoryInterface() = default; + + ACPIFactoryInterface& operator=(const ACPIFactoryInterface&) = default; + ACPIFactoryInterface(const ACPIFactoryInterface&) = default; + + public: + Bool 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); + + private: + VoidPtr fRsdp{nullptr}; // pointer to root descriptor. + SizeT fEntries{0UL}; // number of entries, -1 tells that no invalid entries were + // found. +}; +} // namespace Kernel + +#endif // !__MOD_ACPI_H__ |
