summaryrefslogtreecommitdiffhomepage
path: root/dev/Kernel/HALKit/POWER
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:13:48 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-23 19:15:17 +0100
commita13e1c0911c0627184bc38f18c7fdda64447b3ad (patch)
tree073a62c09bf216e85a3f310376640fa1805147f9 /dev/Kernel/HALKit/POWER
parent149fa096eb306d03686b3b67e813cf1a78e08cd0 (diff)
meta(kernel): Reworked repository's filesystem structure.
Removing useless parts of the project too. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'dev/Kernel/HALKit/POWER')
-rw-r--r--dev/Kernel/HALKit/POWER/.gitkeep0
-rw-r--r--dev/Kernel/HALKit/POWER/AP.h39
-rw-r--r--dev/Kernel/HALKit/POWER/APM/.gitkeep0
-rw-r--r--dev/Kernel/HALKit/POWER/HalAP.cc40
-rw-r--r--dev/Kernel/HALKit/POWER/HalDebugOutput.cc27
-rw-r--r--dev/Kernel/HALKit/POWER/HalStartSequence.s14
-rw-r--r--dev/Kernel/HALKit/POWER/HalThread.cc8
-rw-r--r--dev/Kernel/HALKit/POWER/HalVirtualMemory.cc49
-rw-r--r--dev/Kernel/HALKit/POWER/MBCI/.gitkeep0
-rw-r--r--dev/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cc8
-rw-r--r--dev/Kernel/HALKit/POWER/Processor.h62
-rw-r--r--dev/Kernel/HALKit/POWER/ReadMe.md4
12 files changed, 0 insertions, 251 deletions
diff --git a/dev/Kernel/HALKit/POWER/.gitkeep b/dev/Kernel/HALKit/POWER/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/Kernel/HALKit/POWER/.gitkeep
+++ /dev/null
diff --git a/dev/Kernel/HALKit/POWER/AP.h b/dev/Kernel/HALKit/POWER/AP.h
deleted file mode 100644
index e0ef3ffb..00000000
--- a/dev/Kernel/HALKit/POWER/AP.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
- File: AP.h
- Purpose: POWER hardware threads.
-
- Revision History:
-
- 14/04/24: Added file (amlel)
-
-------------------------------------------- */
-
-#pragma once
-
-#include <NewKit/Defines.h>
-
-namespace NeOS
-{
- struct HAL_HARDWARE_THREAD;
-
- /// @brief hardware thread indentification type.
- typedef NeOS::Int32 hal_ap_kind;
-
- /// @brief Hardware thread information structure.
- typedef struct HAL_HARDWARE_THREAD
- {
- NeOS::UIntPtr fStartAddress;
- NeOS::UInt8 fPrivleged : 1;
- NeOS::UInt32 fPageMemoryFlags;
- hal_ap_kind fIdentNumber;
- } HAL_HARDWARE_THREAD;
-
- /// @brief Set PC to specific hart.
- /// @param hart the hart
- /// @param epc the pc.
- /// @return
- EXTERN_C NeOS::Void hal_set_pc_to_hart(HAL_HARDWARE_THREAD* hart, NeOS::VoidPtr epc);
-} // namespace NeOS
diff --git a/dev/Kernel/HALKit/POWER/APM/.gitkeep b/dev/Kernel/HALKit/POWER/APM/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/Kernel/HALKit/POWER/APM/.gitkeep
+++ /dev/null
diff --git a/dev/Kernel/HALKit/POWER/HalAP.cc b/dev/Kernel/HALKit/POWER/HalAP.cc
deleted file mode 100644
index 32f91a5f..00000000
--- a/dev/Kernel/HALKit/POWER/HalAP.cc
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <HALKit/POWER/Processor.h>
-#include <KernelKit/DebugOutput.h>
-#include <HALKit/POWER/AP.h>
-
-using namespace NeOS;
-
-namespace NeOS::Detail
-{
- STATIC void mp_hang_fn(void)
- {
- while (YES)
- ;
- }
-} // namespace NeOS::Detail
-
-/// @brief wakes up thread.
-/// wakes up thread from hang.
-void mp_wakeup_thread(HAL::StackFramePtr stack)
-{
- if (!stack)
- return;
-
- hal_set_pc_to_hart(reinterpret_cast<HAL_HARDWARE_THREAD*>(stack->R15), reinterpret_cast<VoidPtr>(stack->BP));
-}
-
-/// @brief makes thread sleep.
-/// hooks and hangs thread to prevent code from executing.
-void mp_hang_thread(HAL::StackFramePtr stack)
-{
- if (!stack)
- return;
-
- hal_set_pc_to_hart(reinterpret_cast<HAL_HARDWARE_THREAD*>(stack->R15), reinterpret_cast<VoidPtr>(NeOS::Detail::mp_hang_fn));
-}
diff --git a/dev/Kernel/HALKit/POWER/HalDebugOutput.cc b/dev/Kernel/HALKit/POWER/HalDebugOutput.cc
deleted file mode 100644
index e9b2c85a..00000000
--- a/dev/Kernel/HALKit/POWER/HalDebugOutput.cc
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <HALKit/POWER/Processor.h>
-#include <KernelKit/DebugOutput.h>
-
-using namespace NeOS;
-
-/// @brief Writes to COM1.
-/// @param bytes
-void ke_io_write(const Char* bytes)
-{
- if (!bytes)
- return;
-
- SizeT index = 0;
- SizeT len = rt_string_len(bytes, 256U);
-
- while (index < len)
- {
- // TODO
- ++index;
- }
-}
diff --git a/dev/Kernel/HALKit/POWER/HalStartSequence.s b/dev/Kernel/HALKit/POWER/HalStartSequence.s
deleted file mode 100644
index 2882be80..00000000
--- a/dev/Kernel/HALKit/POWER/HalStartSequence.s
+++ /dev/null
@@ -1,14 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-.globl __ImageStart
-.extern hal_init_platform
-.align 4
-.text
-
-__ImageStart:
- bl hal_init_platform
- blr
diff --git a/dev/Kernel/HALKit/POWER/HalThread.cc b/dev/Kernel/HALKit/POWER/HalThread.cc
deleted file mode 100644
index 0d2e140b..00000000
--- a/dev/Kernel/HALKit/POWER/HalThread.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <HALKit/POWER/Processor.h>
-#include <KernelKit/DebugOutput.h>
diff --git a/dev/Kernel/HALKit/POWER/HalVirtualMemory.cc b/dev/Kernel/HALKit/POWER/HalVirtualMemory.cc
deleted file mode 100644
index d3d4b694..00000000
--- a/dev/Kernel/HALKit/POWER/HalVirtualMemory.cc
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <HALKit/POWER/Processor.h>
-#include <KernelKit/DebugOutput.h>
-#include <HALKit/POWER/MMU.h>
-
-/// @note Refer to SoC documentation.
-
-using namespace NeOS;
-
-EXTERN_C Void hal_write_tlb(UInt32 mas0, UInt32 mas1, UInt32 mas2, UInt32 mas3, UInt32 mas7)
-{
- hal_mtspr(MAS0, mas0);
- hal_mtspr(MAS1, mas1);
- hal_mtspr(MAS2, mas2);
- hal_mtspr(MAS3, mas3);
- hal_mtspr(MAS7, mas7);
-
- hal_flush_tlb();
-}
-
-EXTERN_C Bool hal_set_tlb(UInt8 tlb, UInt32 epn, UInt64 rpn, UInt8 perms, UInt8 wimge, UInt8 ts, UInt8 esel, UInt8 tsize, UInt8 iprot)
-{
- if ((hal_mfspr(SPRN_MMUCFG) & MMUCFG_MAVN) == MMUCFG_MAVN_V1 && (tsize & 1))
- {
- // this MMU does not allow odd tsize values
- return false;
- }
-
- UInt32 mas0 = FSL_BOOKE_MAS0(tlb, esel, 0);
- UInt32 mas1 = FSL_BOOKE_MAS1(1, iprot, 0, ts, tsize);
- UInt32 mas2 = FSL_BOOKE_MAS2(epn, wimge);
- UInt32 mas3 = FSL_BOOKE_MAS3(rpn, 0, perms);
- UInt32 mas7 = FSL_BOOKE_MAS7(rpn);
-
- hal_write_tlb(mas0, mas1, mas2, mas3, mas7);
-
- return true;
-}
-
-/// @brief Flush TLB
-EXTERN_C void hal_flush_tlb()
-{
- asm volatile("isync;tlbwe;msync;isync");
-}
diff --git a/dev/Kernel/HALKit/POWER/MBCI/.gitkeep b/dev/Kernel/HALKit/POWER/MBCI/.gitkeep
deleted file mode 100644
index e69de29b..00000000
--- a/dev/Kernel/HALKit/POWER/MBCI/.gitkeep
+++ /dev/null
diff --git a/dev/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cc b/dev/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cc
deleted file mode 100644
index 0d2e140b..00000000
--- a/dev/Kernel/HALKit/POWER/MBCI/HalMBCIHost.cc
+++ /dev/null
@@ -1,8 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
-------------------------------------------- */
-
-#include <HALKit/POWER/Processor.h>
-#include <KernelKit/DebugOutput.h>
diff --git a/dev/Kernel/HALKit/POWER/Processor.h b/dev/Kernel/HALKit/POWER/Processor.h
deleted file mode 100644
index bbcfd01f..00000000
--- a/dev/Kernel/HALKit/POWER/Processor.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -------------------------------------------
-
- Copyright (C) 2024-2025, Amlal EL Mahrouss, all rights reserved.
-
- Purpose: POWER processor header.
-
-------------------------------------------- */
-
-#pragma once
-
-#include <NewKit/Defines.h>
-#include <NewKit/Utils.h>
-
-#define NoOp() asm volatile("mr 0, 0")
-#define kHalPPCAlignment __attribute__((aligned(4)))
-
-namespace NeOS::HAL
-{
- typedef UIntPtr Reg;
-
- /// @brief Stack frame (as retrieved from assembly.)
- struct PACKED StackFrame final
- {
- Reg R8{0};
- Reg R9{0};
- Reg R10{0};
- Reg R11{0};
- Reg R12{0};
- Reg R13{0};
- Reg R14{0};
- Reg R15{0};
- Reg SP{0};
- Reg BP{0};
- };
-
- typedef StackFrame* StackFramePtr;
-
- inline void rt_halt()
- {
- while (true)
- {
- NoOp(); // no oop.
- }
- }
-
- inline void rt_cli()
- {
- NoOp(); // no oop
- }
-} // namespace NeOS::HAL
-
-EXTERN_C NeOS::Void int_handle_math(NeOS::UIntPtr sp);
-EXTERN_C NeOS::Void int_handle_pf(NeOS::UIntPtr sp);
-
-/// @brief Set TLB.
-NeOS::Bool hal_set_tlb(NeOS::UInt8 tlb, NeOS::UInt32 epn, NeOS::UInt64 rpn, NeOS::UInt8 perms, NeOS::UInt8 wimge, NeOS::UInt8 ts, NeOS::UInt8 esel, NeOS::UInt8 tsize, NeOS::UInt8 iprot);
-
-/// @brief Write TLB.
-NeOS::Void hal_write_tlb(NeOS::UInt32 mas0, NeOS::UInt32 mas1, NeOS::UInt32 mas2, NeOS::UInt32 mas3, NeOS::UInt32 mas7);
-
-/// @brief Flush TLB.
-EXTERN_C NeOS::Void hal_flush_tlb();
diff --git a/dev/Kernel/HALKit/POWER/ReadMe.md b/dev/Kernel/HALKit/POWER/ReadMe.md
deleted file mode 100644
index a9751581..00000000
--- a/dev/Kernel/HALKit/POWER/ReadMe.md
+++ /dev/null
@@ -1,4 +0,0 @@
-POWER Hardware Abstraction Layer
-
-- Supported CPU: POWER
-- Supported Firmware: CoreBoot \ No newline at end of file