summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-16 11:04:10 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2025-03-16 11:04:10 +0100
commit8df934fd614ffa04f5bea091b02c848b1d703049 (patch)
tree8789a443b71a9aceaec2eb2da8716870487ee716
parent959369a5b4ec5010952fb9336c001425653747ef (diff)
AHCI: FIX: Place det || ipm condition before checking for ATAPI/SATA.
AHCI: Finish .drawio design of AHCI driver. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc5
-rw-r--r--dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc4
-rw-r--r--doc/AHCI.drawio22
-rw-r--r--doc/AHCI_DESIGN.drawio40
4 files changed, 47 insertions, 24 deletions
diff --git a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
index 0400970e..9f03754c 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/AHCI+Generic.cc
@@ -257,7 +257,10 @@ STATIC Bool drv_std_init_ahci(UInt16& pi, BOOL atapi)
UInt8 ipm = (mem_ahci->Ports[ahci_index].Ssts >> 8) & 0x0F;
UInt8 det = mem_ahci->Ports[ahci_index].Ssts & 0x0F;
- if (mem_ahci->Ports[ahci_index].Sig == kSATASignature && det == kSATAPresent && ipm == kSATAIPMActive)
+ if (det != kSATAPresent || ipm != kSATAIPMActive)
+ continue;
+
+ if (mem_ahci->Ports[ahci_index].Sig == kSATASignature)
{
kout << "Detect: /dev/sat" << number(ahci_index) << kendl;
diff --git a/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc b/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc
index 62791aee..8e6197c9 100644
--- a/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc
+++ b/dev/Kernel/HALKit/AMD64/Storage/PIO+Generic.cc
@@ -23,7 +23,7 @@
using namespace NeOS;
using namespace NeOS::HAL;
-/// bugs: 0
+/// BUGS: 0
#define kATADataLen 512
@@ -107,6 +107,8 @@ ATAInit_Retry:
kCurrentDiskModel[40] = '\0';
+ kout << "Detect: /dev/ata0" << kendl;
+
kout << "Drive Model: " << kCurrentDiskModel << kendl;
return true;
diff --git a/doc/AHCI.drawio b/doc/AHCI.drawio
deleted file mode 100644
index 191f04aa..00000000
--- a/doc/AHCI.drawio
+++ /dev/null
@@ -1,22 +0,0 @@
-<mxfile host="65bd71144e">
- <diagram id="n4yoMa775TB45TuBg3XL" name="Page-1">
- <mxGraphModel dx="1144" dy="698" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
- <root>
- <mxCell id="0"/>
- <mxCell id="1" parent="0"/>
- <mxCell id="4" style="edgeStyle=none;html=1;" edge="1" parent="1" source="2" target="3">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="2" value="DEV" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="490" y="310" width="120" height="170" as="geometry"/>
- </mxCell>
- <mxCell id="5" style="edgeStyle=none;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.25;entryDx=0;entryDy=0;" edge="1" parent="1" source="3" target="2">
- <mxGeometry relative="1" as="geometry"/>
- </mxCell>
- <mxCell id="3" value="HOST" style="rounded=1;whiteSpace=wrap;html=1;" vertex="1" parent="1">
- <mxGeometry x="170" y="310" width="120" height="170" as="geometry"/>
- </mxCell>
- </root>
- </mxGraphModel>
- </diagram>
-</mxfile> \ No newline at end of file
diff --git a/doc/AHCI_DESIGN.drawio b/doc/AHCI_DESIGN.drawio
new file mode 100644
index 00000000..73029de7
--- /dev/null
+++ b/doc/AHCI_DESIGN.drawio
@@ -0,0 +1,40 @@
+<mxfile host="65bd71144e">
+ <diagram id="n4yoMa775TB45TuBg3XL" name="Page-1">
+ <mxGraphModel dx="1144" dy="698" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="0">
+ <root>
+ <mxCell id="0"/>
+ <mxCell id="1" parent="0"/>
+ <mxCell id="4" style="edgeStyle=none;html=1;" parent="1" source="2" target="3" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="8" style="edgeStyle=none;html=1;exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" edge="1" parent="1" source="2" target="6">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="2" value="DRIVER I/O" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="490" y="310" width="120" height="170" as="geometry"/>
+ </mxCell>
+ <mxCell id="5" style="edgeStyle=none;html=1;exitX=1;exitY=0.25;exitDx=0;exitDy=0;entryX=0;entryY=0.25;entryDx=0;entryDy=0;" parent="1" source="3" target="2" edge="1">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="3" value="AHCI CTRL" style="rounded=0;whiteSpace=wrap;html=1;" parent="1" vertex="1">
+ <mxGeometry x="170" y="310" width="120" height="170" as="geometry"/>
+ </mxCell>
+ <mxCell id="7" style="edgeStyle=none;html=1;exitX=0;exitY=0.25;exitDx=0;exitDy=0;entryX=1;entryY=0.25;entryDx=0;entryDy=0;" edge="1" parent="1" source="6" target="2">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="6" value="SK + AHCI FUNCTIONS" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+ <mxGeometry x="630" y="310" width="100" height="170" as="geometry"/>
+ </mxCell>
+ <mxCell id="10" style="edgeStyle=none;html=1;entryX=0.5;entryY=1;entryDx=0;entryDy=0;" edge="1" parent="1" source="9" target="2">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ <mxCell id="9" value="MAIN AHCI&lt;br&gt;DRIVER" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
+ <mxGeometry x="630" y="490" width="100" height="170" as="geometry"/>
+ </mxCell>
+ <mxCell id="11" style="edgeStyle=none;html=1;exitX=0.25;exitY=1;exitDx=0;exitDy=0;entryX=0.03;entryY=0.841;entryDx=0;entryDy=0;entryPerimeter=0;" edge="1" parent="1" source="2" target="9">
+ <mxGeometry relative="1" as="geometry"/>
+ </mxCell>
+ </root>
+ </mxGraphModel>
+ </diagram>
+</mxfile> \ No newline at end of file