summaryrefslogtreecommitdiffhomepage
path: root/Private/HALKit
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-17 19:54:32 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-17 19:54:32 +0100
commita8366afaf39321ae2bbae70740f5ca65bee06769 (patch)
treee7c7384a2611a02dacae4e1f0e43b863b541fad5 /Private/HALKit
parent5a0a901f6d4a4499c13877376ff34e6411500410 (diff)
unrelated: Rework the ACPI interface.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/HALKit')
-rw-r--r--Private/HALKit/AMD64/CPUID.hxx2
-rw-r--r--Private/HALKit/AMD64/HalACPIFactoryInterface.cxx (renamed from Private/HALKit/AMD64/HalACPIManager.cpp)12
-rw-r--r--Private/HALKit/AMD64/HalCoreMultiProcessingAMD64.cpp19
3 files changed, 17 insertions, 16 deletions
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++