diff options
| -rw-r--r-- | Private/Builtins/ACPI/ACPIFactoryInterface.hxx (renamed from Private/Builtins/ACPI/ACPIManager.hxx) | 20 | ||||
| -rw-r--r-- | Private/Builtins/README.TXT | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/CPUID.hxx | 2 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalACPIFactoryInterface.cxx (renamed from Private/HALKit/AMD64/HalACPIManager.cpp) | 12 | ||||
| -rw-r--r-- | Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp | 19 |
5 files changed, 32 insertions, 23 deletions
diff --git a/Private/Builtins/ACPI/ACPIManager.hxx b/Private/Builtins/ACPI/ACPIFactoryInterface.hxx index 1fa5e714..21cd026e 100644 --- a/Private/Builtins/ACPI/ACPIManager.hxx +++ b/Private/Builtins/ACPI/ACPIFactoryInterface.hxx @@ -13,20 +13,28 @@ #include <NewKit/Ref.hpp> namespace HCore { -class ACPIManager final { +class ACPIFactoryInterface final { public: - explicit ACPIManager(voidPtr rsdPtr); - ~ACPIManager() = default; + explicit ACPIFactoryInterface(voidPtr rsdPtr); + ~ACPIFactoryInterface() = default; - ACPIManager &operator=(const ACPIManager &) = default; - ACPIManager(const ACPIManager &) = default; + ACPIFactoryInterface &operator=(const ACPIFactoryInterface &) = default; + ACPIFactoryInterface(const ACPIFactoryInterface &) = default; public: void Shutdown(); // shutdown - void Reset(); // soft-reboot + 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: diff --git a/Private/Builtins/README.TXT b/Private/Builtins/README.TXT index ce39f472..2e341e5d 100644 --- a/Private/Builtins/README.TXT +++ b/Private/Builtins/README.TXT @@ -12,5 +12,5 @@ These are HCore builtins device drivers. Maintainers =========== -ACPIManager: Amlal EL Mahrouss +ACPIFactoryInterface: Amlal EL Mahrouss AHCI: Amlal EL Mahrouss
\ No newline at end of file diff --git a/Private/HALKit/AMD64/CPUID.hxx b/Private/HALKit/AMD64/CPUID.hxx index 2eac5bcb..381e07d4 100644 --- a/Private/HALKit/AMD64/CPUID.hxx +++ b/Private/HALKit/AMD64/CPUID.hxx @@ -2,7 +2,7 @@ Copyright Mahrouss Logic - File: CPUID.hpp + File: CPUID.hxx Purpose: CPUID flags. Revision History: diff --git a/Private/HALKit/AMD64/HalACPIManager.cpp b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx index b73dd996..f3e120b6 100644 --- a/Private/HALKit/AMD64/HalACPIManager.cpp +++ b/Private/HALKit/AMD64/HalACPIFactoryInterface.cxx @@ -4,23 +4,23 @@ ------------------------------------------- */ -#include <Builtins/ACPI/ACPIManager.hxx> +#include <Builtins/ACPI/ACPIFactoryInterface.hxx> #include <HALKit/AMD64/Processor.hpp> #include <NewKit/String.hpp> namespace HCore { -ACPIManager::ACPIManager(voidPtr rsdPtr) : m_Rsdp(rsdPtr), m_Entries(0) { +ACPIFactoryInterface::ACPIFactoryInterface(voidPtr rsdPtr) : m_Rsdp(rsdPtr), m_Entries(0) { volatile RSDP *_rsdPtr = reinterpret_cast<volatile RSDP *>(this->m_Rsdp); MUST_PASS(_rsdPtr); MUST_PASS(_rsdPtr->Revision >= 2); } -void ACPIManager::Shutdown() {} -void ACPIManager::Reset() {} +void ACPIFactoryInterface::Shutdown() {} +void ACPIFactoryInterface::Reboot() {} /// @brief Finds a descriptor table inside ACPI XSDT. -ErrorOr<voidPtr> ACPIManager::Find(const char *signature) { +ErrorOr<voidPtr> ACPIFactoryInterface::Find(const char *signature) { MUST_PASS(m_Rsdp); if (!signature) return ErrorOr<voidPtr>{-2}; @@ -50,7 +50,7 @@ ErrorOr<voidPtr> ACPIManager::Find(const char *signature) { @param checksum the header to checksum @param len the length of it. */ -bool ACPIManager::Checksum(const char *checksum, SSizeT len) { +bool ACPIFactoryInterface::Checksum(const char *checksum, SSizeT len) { if (len == 0) return -1; char chr = 0; diff --git a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp index edb821b9..d9161d17 100644 --- a/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp +++ b/Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp @@ -4,7 +4,7 @@ ------------------------------------------- */ -#include <Builtins/ACPI/ACPIManager.hxx> +#include <Builtins/ACPI/ACPIFactoryInterface.hxx> #include <HALKit/AMD64/Processor.hpp> /////////////////////////////////////////////////////////////////////////////////////// @@ -39,10 +39,11 @@ struct ProcessorInfoAMD64 final { } Selector; }; -static voidPtr kApicMadt = nullptr; -static const char* kApicSignature = "APIC"; +STATIC voidPtr kApicMadt = nullptr; +STATIC const char* kApicSignature = "APIC"; -struct Madt final { +/// @brief Multiple APIC descriptor table. +struct MadtType final { char fMag[4]; Int32 fLength; char fRev; @@ -90,10 +91,10 @@ struct MadtLocalApicAddressOverride final { /////////////////////////////////////////////////////////////////////////////////////// -static Madt kApicMadtList[256]; +STATIC MadtType kApicMadtList[256]; -Madt* system_find_core(Madt* madt) { - madt = madt + sizeof(Madt); +MadtType* system_find_core(MadtType* madt) { + madt = madt + sizeof(MadtType); if (rt_string_cmp(madt->fMag, kApicSignature, rt_string_len(kApicSignature)) == 0) @@ -105,13 +106,13 @@ Madt* system_find_core(Madt* madt) { /////////////////////////////////////////////////////////////////////////////////////// void hal_system_get_cores(voidPtr rsdPtr) { - auto acpi = ACPIManager(rsdPtr); + auto acpi = ACPIFactoryInterface(rsdPtr); kApicMadt = acpi.Find(kApicSignature).Leak().Leak(); MUST_PASS(kApicMadt); // MADT must exist. SizeT counter = 0UL; - Madt* offset = system_find_core((Madt*)kApicMadt); + MadtType* offset = system_find_core((MadtType*)kApicMadt); //! now find core addresses. while (offset != nullptr) { // calls rt_copy_memory in NewC++ |
