summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-20 15:24:53 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-20 15:24:53 +0100
commitb3795cedd8f6409f52157f34e9acc8af9143e320 (patch)
tree8d5492572b90f6122f75f5f9365d58007a244e6b
parentd1b7d34c43ec463815c448e7677fc64ec936504a (diff)
AHCI-Generic.cc: Disk Driver builtin improvements.
- Poll for CR in ahci_enable_and_probe. - Init NeFS, not an AHCI device for portability. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--ReadMe.md13
-rw-r--r--dev/Kernel/HALKit/AMD64/HalKernelMain.cc2
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc10
3 files changed, 17 insertions, 8 deletions
diff --git a/ReadMe.md b/ReadMe.md
index 253d7d7c..1f0554bc 100644
--- a/ReadMe.md
+++ b/ReadMe.md
@@ -2,27 +2,28 @@
# NeKernel
-## Requirements:
+
+
+## Required:
- MinGW/GCC, Clang.
-- LibCompiler Runtime Headers and Toolchain.
- Netwide Assembler.
- Git.
- BTB.
-## Installation:
+## Install:
Clone repository:
```sh
git clone git@github.com:ne-gh/kernel.git
cd kernel
-./debug_ahci.sh # Generic AHCI target
+./debug_ata.sh # Generic ATA PIO target
```
-## Good first PRs
+## Good first PRs:
-- Contribute to the AHCI generic driver (PRDs are not being read)
+- Contribute to the AHCI generic driver, it's the current main effort to bring modern storage standards to the kernel.
## Warning:
diff --git a/dev/Kernel/HALKit/AMD64/HalKernelMain.cc b/dev/Kernel/HALKit/AMD64/HalKernelMain.cc
index 0e2247ad..e87e6fb1 100644
--- a/dev/Kernel/HALKit/AMD64/HalKernelMain.cc
+++ b/dev/Kernel/HALKit/AMD64/HalKernelMain.cc
@@ -94,7 +94,7 @@ EXTERN_C void hal_init_platform(
EXTERN_C NeOS::Void hal_real_init(NeOS::Void) noexcept
{
- auto dev = NeOS::sk_init_ahci_device(NO);
+ NeOS::NeFS::fs_init_nefs();
NeOS::HAL::mp_get_cores(kHandoverHeader->f_HardwareTables.f_VendorPtr);
diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 51db8054..ae0ae239 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -73,7 +73,7 @@ STATIC Void drv_compute_disk_ahci() noexcept
{
kSATASectorCount = 0UL;
- const UInt16 kSzIdent = 512;
+ const UInt16 kSzIdent = kib_cast(1);
UInt8 identify_data[kSzIdent] = {0};
@@ -205,6 +205,7 @@ SizeT drv_get_size_ahci()
return drv_get_sector_count() * kAHCISectorSize;
}
+/// @brief Enable Host and probe using the IDENTIFY command.
STATIC Void ahci_enable_and_probe()
{
if (kSATAHba->Bohc & kHBABohcBiosOwned)
@@ -213,9 +214,16 @@ STATIC Void ahci_enable_and_probe()
while (kSATAHba->Bohc & kHBABohcBiosOwned)
{
+ ;
}
}
+ // Poll until ready.
+ while (kSATAHba->Ports[kSATAIndex].Cmd & kHBAPxCmdCR)
+ {
+ ;
+ }
+
kSATAHba->Ports[kSATAIndex].Cmd |= kHBAPxCmdFre;
kSATAHba->Ports[kSATAIndex].Cmd |= kHBAPxCmdST;