diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-22 20:21:08 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2025-03-22 20:21:08 +0100 |
| commit | eba5dbf36b5c96ce8d3e2c46cf9d798c3fb7ec89 (patch) | |
| tree | b3fb44810197b791c62b64a1069fd385fba23f8e | |
| parent | 89e8d71556a88fa36f8b18a553f589ab66748895 (diff) | |
kernel(general): Refactor AHCI driver and clean up project structure
- Reworked AHCI command setup: fixed command slot indexing and clarified memory setup
- Updated AHCI disk initialization to use reference for ATAPI flag
- Cleaned up verbose logging in scheduler and IRQ handler for a quieter kernel log
- Updated boot image target from fat32.img to neos.img
- Renamed and moved documentation files from `doc/` to `docs/` for consistency
- Renamed `make_docs.sh` to `osx_docs.sh` to reflect platform-specific intent
- Minor formatting improvements in DiskImage struct
- Revised ReadMe: clarified mount instructions and removed outdated screenshots
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
| -rw-r--r-- | ReadMe.md | 15 | ||||
| -rw-r--r-- | dev/Boot/amd64-desktop.make | 2 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc | 1 | ||||
| -rw-r--r-- | dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc | 11 | ||||
| -rw-r--r-- | dev/Kernel/src/UserProcessScheduler.cc | 3 | ||||
| -rw-r--r-- | docs/AHCI_DESIGN.drawio (renamed from doc/AHCI_DESIGN.drawio) | 0 | ||||
| -rw-r--r-- | docs/DDK.pdf (renamed from doc/DDK.pdf) | bin | 24997 -> 24997 bytes | |||
| -rw-r--r-- | docs/EPM.pdf (renamed from doc/EPM.pdf) | bin | 12517 -> 12517 bytes | |||
| -rw-r--r-- | docs/GUI_DESIGN.drawio (renamed from doc/GUI_DESIGN.drawio) | 0 | ||||
| -rw-r--r-- | docs/MBCI.drawio (renamed from doc/MBCI.drawio) | 0 | ||||
| -rw-r--r-- | docs/MFlash.pdf (renamed from doc/MFlash.pdf) | bin | 25005 -> 25005 bytes | |||
| -rw-r--r-- | docs/NeFS.pdf (renamed from doc/NeFS.pdf) | bin | 13466 -> 13466 bytes | |||
| -rw-r--r-- | docs/OS_DESIGN.drawio (renamed from doc/OS_DESIGN.drawio) | 0 | ||||
| -rw-r--r-- | docs/ROUND_ROBIN.drawio (renamed from doc/ROUND_ROBIN.drawio) | 0 | ||||
| -rw-r--r-- | docs/SCHED_DESIGN.drawio (renamed from doc/SCHED_DESIGN.drawio) | 0 | ||||
| -rw-r--r-- | docs/TIMER_DESIGN.drawio (renamed from doc/TIMER_DESIGN.drawio) | 0 | ||||
| -rw-r--r-- | docs/ZXD.drawio (renamed from doc/ZXD.drawio) | 0 | ||||
| -rw-r--r-- | docs/apic.png (renamed from doc/apic.png) | bin | 203155 -> 203155 bytes | |||
| -rw-r--r-- | docs/filesystem.png (renamed from doc/filesystem.png) | bin | 174261 -> 174261 bytes | |||
| -rwxr-xr-x | osx_docs.sh (renamed from make_docs.sh) | 0 | ||||
| -rw-r--r-- | public/frameworks/DiskImage.fwrk/headers/DiskImage.h | 16 |
21 files changed, 21 insertions, 27 deletions
@@ -10,13 +10,10 @@ - [GIT](https://git-scm.com/) - [BTB](https://github.com/ne-gh/btb) -## Builders's Notice: +## Notice for Contributors: -You must mount the contents to the fat32.img prior running! Otherwise the emulator won't find a valid ESP. - -## Contributors's Notice: - -Always use `run_format.sh` before commiting and pushing your code! +- You must mount the contents to the neos.img prior running! Otherwise the emulator won't find a valid ESP. +- Always use `run_format.sh` before commiting and pushing your code! ## Quick Install: @@ -29,10 +26,4 @@ cd kernel ./debug_ata.sh # Generic ATA PIO target ``` -## Screenshots: - - - - - ###### Copyright (C) 2024-2025 Amlal EL Mahrouss, All rights reserved. diff --git a/dev/Boot/amd64-desktop.make b/dev/Boot/amd64-desktop.make index c1564b77..bf61b24e 100644 --- a/dev/Boot/amd64-desktop.make +++ b/dev/Boot/amd64-desktop.make @@ -28,7 +28,7 @@ BIOS=OVMF.fd IMG=epm-master-1.img IMG_2=epm-master-2.img -BOOT=./src/fat32.img +BOOT=./src/neos.img DISK_DRV = diff --git a/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc b/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc index bc4bd330..05326ecb 100644 --- a/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc +++ b/dev/Kernel/HALKit/AMD64/HalCoreInterruptHandlerAMD64.cc @@ -74,7 +74,6 @@ EXTERN_C void idt_handle_scheduler(NeOS::UIntPtr rsp) try_count_before_brute = 100000UL; kIsScheduling = YES; - kout << "Kernel: Timer IRQ (Scheduler Notification).\r"; NeOS::UserProcessHelper::StartScheduling(); kIsScheduling = NO; diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc index 27a57a93..a17f3843 100644 --- a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc +++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc @@ -115,6 +115,8 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz volatile HbaCmdHeader* command_header = ((HbaCmdHeader*)(((UInt64)kSATAHba->Ports[kSATAIndex].Clb))); + command_header += slot; + MUST_PASS(command_header); command_header->Cfl = sizeof(FisRegH2D) / sizeof(UInt32); @@ -122,6 +124,7 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz command_header->Prdtl = (UInt16)((size_buffer - 1) >> 4) + 1; HbaCmdTbl* command_table = (HbaCmdTbl*)((VoidPtr)((UInt64)command_header->Ctba)); + rt_set_memory(command_table, 0, sizeof(HbaCmdTbl) + (command_header->Prdtl - 1) * sizeof(HbaPrdtEntry)); MUST_PASS(command_table); @@ -166,7 +169,9 @@ STATIC Void drv_std_input_output(UInt64 lba, UInt8* buffer, SizeT sector_sz, Siz h2d_fis->CountHigh = (size_buffer >> 8) & 0xFF; while (kSATAHba->Ports[kSATAIndex].Tfd & (kSATASRBsy | kSATASRDrq)) + { ; + } kSATAHba->Ports[kSATAIndex].Ci = (1 << slot); @@ -232,8 +237,9 @@ STATIC Void ahci_enable_and_probe() /// @brief Initializes an AHCI disk. /// @param pi the amount of ports that have been detected. +/// @param atapi reference value, tells whether we should detect ATAPI instead of SATA. /// @return if the disk was successfully initialized or not. -STATIC Bool drv_std_init_ahci(UInt16& pi, BOOL atapi) +STATIC Bool drv_std_init_ahci(UInt16& pi, BOOL& atapi) { PCI::Iterator iterator(Types::PciDeviceKind::MassStorageController); @@ -390,7 +396,8 @@ Void drv_std_read(UInt64 lba, Char* buffer, SizeT sector_sz, SizeT size_buffer) Bool drv_std_init(UInt16& pi) { - return drv_std_init_ahci(pi, NO); + BOOL atapi = NO; + return drv_std_init_ahci(pi, atapi); } Bool drv_std_detected(Void) diff --git a/dev/Kernel/src/UserProcessScheduler.cc b/dev/Kernel/src/UserProcessScheduler.cc index 95885ee5..1087ac6b 100644 --- a/dev/Kernel/src/UserProcessScheduler.cc +++ b/dev/Kernel/src/UserProcessScheduler.cc @@ -436,9 +436,6 @@ namespace NeOS kout << "UserProcessScheduler::Run(): This team doesn't have any process!\r"; return 0UL; } - - kout << "UserProcessScheduler::Run(): This team has a process capacity of: " << hex_number(mTeam.mProcessList.Capacity()) << kendl; - for (; process_index < mTeam.AsArray().Capacity(); ++process_index) { auto& process = mTeam.AsArray()[process_index]; diff --git a/doc/AHCI_DESIGN.drawio b/docs/AHCI_DESIGN.drawio index 73029de7..73029de7 100644 --- a/doc/AHCI_DESIGN.drawio +++ b/docs/AHCI_DESIGN.drawio diff --git a/doc/DDK.pdf b/docs/DDK.pdf Binary files differindex 7029e0cc..7029e0cc 100644 --- a/doc/DDK.pdf +++ b/docs/DDK.pdf diff --git a/doc/EPM.pdf b/docs/EPM.pdf Binary files differindex d9eeebc9..d9eeebc9 100644 --- a/doc/EPM.pdf +++ b/docs/EPM.pdf diff --git a/doc/GUI_DESIGN.drawio b/docs/GUI_DESIGN.drawio index 3ada69be..3ada69be 100644 --- a/doc/GUI_DESIGN.drawio +++ b/docs/GUI_DESIGN.drawio diff --git a/doc/MBCI.drawio b/docs/MBCI.drawio index 9a8f4283..9a8f4283 100644 --- a/doc/MBCI.drawio +++ b/docs/MBCI.drawio diff --git a/doc/MFlash.pdf b/docs/MFlash.pdf Binary files differindex 2e6d7d42..2e6d7d42 100644 --- a/doc/MFlash.pdf +++ b/docs/MFlash.pdf diff --git a/doc/NeFS.pdf b/docs/NeFS.pdf Binary files differindex 1b804346..1b804346 100644 --- a/doc/NeFS.pdf +++ b/docs/NeFS.pdf diff --git a/doc/OS_DESIGN.drawio b/docs/OS_DESIGN.drawio index d704b481..d704b481 100644 --- a/doc/OS_DESIGN.drawio +++ b/docs/OS_DESIGN.drawio diff --git a/doc/ROUND_ROBIN.drawio b/docs/ROUND_ROBIN.drawio index 46c6304b..46c6304b 100644 --- a/doc/ROUND_ROBIN.drawio +++ b/docs/ROUND_ROBIN.drawio diff --git a/doc/SCHED_DESIGN.drawio b/docs/SCHED_DESIGN.drawio index ab75d000..ab75d000 100644 --- a/doc/SCHED_DESIGN.drawio +++ b/docs/SCHED_DESIGN.drawio diff --git a/doc/TIMER_DESIGN.drawio b/docs/TIMER_DESIGN.drawio index ca081fd3..ca081fd3 100644 --- a/doc/TIMER_DESIGN.drawio +++ b/docs/TIMER_DESIGN.drawio diff --git a/doc/ZXD.drawio b/docs/ZXD.drawio index 7452d3f9..7452d3f9 100644 --- a/doc/ZXD.drawio +++ b/docs/ZXD.drawio diff --git a/doc/apic.png b/docs/apic.png Binary files differindex 33954dce..33954dce 100644 --- a/doc/apic.png +++ b/docs/apic.png diff --git a/doc/filesystem.png b/docs/filesystem.png Binary files differindex 9e3599a9..9e3599a9 100644 --- a/doc/filesystem.png +++ b/docs/filesystem.png diff --git a/make_docs.sh b/osx_docs.sh index 2d9a0a22..2d9a0a22 100755 --- a/make_docs.sh +++ b/osx_docs.sh diff --git a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h index 704776a4..fb05154d 100644 --- a/public/frameworks/DiskImage.fwrk/headers/DiskImage.h +++ b/public/frameworks/DiskImage.fwrk/headers/DiskImage.h @@ -14,19 +14,19 @@ #define kDISectorSz (512) #define kDIMinDiskSz (1024 * 1024 * 1024) #define kDIDefaultOutputName "disk.eimg" -#define kDIDefaultDiskName "Disk" -#define kDISuccessStatus (0) -#define kDIFailureStatus (1) +#define kDIDefaultDiskName "Disk" +#define kDISuccessStatus (0) +#define kDIFailureStatus (1) struct DI_DISK_IMAGE; struct DI_DISK_IMAGE { - Char disk_name[512] = kDIDefaultDiskName; - SInt32 sector_sz = kDISectorSz; - SInt32 block_cnt = 0; - SizeT disk_sz = kDIMinDiskSz; - Char out_name[256] = kDIDefaultOutputName; + Char disk_name[512] = kDIDefaultDiskName; + SInt32 sector_sz = kDISectorSz; + SInt32 block_cnt = 0; + SizeT disk_sz = kDIMinDiskSz; + Char out_name[256] = kDIDefaultOutputName; }; /// @brief Format with an EPM partition. |
